If no matching colors are found, the formula should return the value “na”.

Both methods are explained below.

It returns TRUE if the value is numeric, and FALSE if not.

Excel formula: Categorize text with keywords

TheSEARCH functionis used to find the starting position of a specific substring within a string.

The syntax is SEARCH(find_text, within_text, [start_num]).

If the substring (find_text) is found, SEARCH returns the starting position as a number.

Excel formula: Get last match cell contains

If not, it results in an error.

TheXLOOKUP functionis a modern upgrade to the older VLOOKUP function.

If a color is found, SEARCH returns the starting position as a number.

Excel formula: Cell contains one of many things

If a color is not found, SEARCH returns an error.

These numbers indicate the numeric positions of the colors “white” and “blue” in cell B5.

errors indicate colors in E5:E11 that were not found.

Excel formula: Cell contains specific text

This value can be omitted or customized as desired.

First match in sentence, or first match in list?

These are two distinctly different operations.

Excel formula: Value exists in a range

The formula above returns the first match found in the color list.

However, instead of using the ISNUMBER function as an error handler, it uses theIFERROR function.

IFERROR is set to catch errors from SEARCH and remap them to a zero (0) value.

Excel formula: Get all matches cell contains

This formula works in much the same way as the XLOOKUP version above.

Thematch_typeargument is set to zero (0) to force an exact match.

AGGREGATE works well here because it has an option to ignore errors.

Excel formula: If cell contains one of many things

The result from AGGREGATE is 5, which is returned to MATCH as thelookup_value.

XLOOKUP supports approximate and exact matching, wildcards (* ?)

SEARCH Function

The Excel SEARCH function returns the location of one text string inside another.

Excel formula: First match between two ranges

SEARCH returns the position offind_textinsidewithin_textas a number.

you’re free to use INDEX to retrieve individual values, or entire rows and columns.

MATCH supports approximate and exact matching, andwildcards(* ?)

Excel XLOOKUP function

Excel ISNUMBER function

Excel SEARCH function

Excel INDEX function

Excel MATCH function

Excel AGGREGATE function