where things is the named range E5:E9. Working from the inside out, this formula is based on the formula described here, which uses the SEARCH function together with the ISNUMBER function: In a nutshell, SEARCH returns a number if it finds the target string and an error if not, and ISNUMBER converts this result into a TRUE or FALSE. In this case, we are looking for several strings at once – the five colors in the named range things (E5:E10), so the code above returns an array with five TRUE FALSE values like this: Notice the TRUE values correspond to white and green in the list of colors (positions 3 and 5), and FALSE values correspond to the colors not found. This array is returned directly to the FILTER function as the include argument, with the array argument given as things: The FILTER function uses the TRUE and FALSE values to filter the list of colors and returns an array of the two colors found: The result from FILTER is delivered to the TEXTJOIN function: TEXTJOIN is configured to join items in the array with a comma and space (", “) and to ignore empty strings (”"). The number 1 is provided instead of TRUE for brevity. TEXTJOIN concatenates the found colors, separated by commas, and returns a final result. Note FILTER’s not_found argument is provided as an empty string (""). In the event no colors are found, FILTER returns an empty string to TEXTJOIN, which then also returns an empty string as the final result.

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.