How to use the FIND function with an array of values to search for individual characters or words.
Introduction
In Google Sheets you use the arrayformula function in conjunction with find to find the first instance of any value from an array in a single cell.
Method
Imagine you wanted to remove the numbers at the end of a cell value, but you didn’t know in advance which numbers they would be, or how long they would be?
You can use the following formula to get the position of the first instance of a number in a cell value (Cell A1 in this example).
If this formula was applied to the string Fred123 it will return 5 as ‘1’ is the 5th character in the string. It works by sorting the response array from the find function and returning the first element (using index).
To return only the part of the string before the number, we can combine it with the mid function, like this:
Or, to return just the number, simply change around the parameter order a litte:
The iferror function is used to catch the scenario where there are no numbers in the string, and just return nothing (although you could also adapt this to return the whole string if preferred).
You can supply any list you want, including words, so you could also adapt the formula to return a true or false value if any character / word in a list occurs in a cell, like:
Remember that find is case-sensitive, so you may want to adjust your ‘search’ list to accomodate this.
Related ► Google Calendars on the Web (01 Sep 2018), Protecting Data with Google Drive (14 Aug 2018), Dealing with confidential information in schools (24 Jul 2018)