The list of things to check for is in thenamed rangethings(E5:E9).

The result is returned as a comma separated text string.

The core search logic isexplained in detail here.

LAMBDA contains which strings sorted

We can reduce the redundant code by assigning intermediate results to variables with the LET function.

Whensortis TRUE, the function will sort search results in the order they appear in text.

the order they are listed in “things”).

LAMBDA contains which strings sorted

The logic for this is handled by theIF function.

The screen below shows the new version of the formula in action.

LET Function

The Excel LET function lets you define named variables in a formula.

LAMBDA contains which strings sorted

SEARCH Function

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

SEARCH returns the position offind_textinsidewithin_textas a number.

The range or array used to sort does not need to appear in results.

LAMBDA contains which strings sorted

LAMBDA contains which strings sorted

Excel formula: LAMBDA contains one of many

Excel formula: Count total words in a cell

Excel formula: LAMBDA replace characters recursive

Excel formula: LAMBDA count words

Excel LAMBDA function

Excel LET function

Excel ISNUMBER function

Excel SEARCH function

Excel SORTBY function