FormulaCraft

How to look up and concatenate all matches in Excel and Google Sheets

Topic:Lookups (any direction)

Heads up: Excel and Google Sheets do this differently.

Excel
=TEXTJOIN(", ",TRUE,IF($A$2:$A$5="Alice",$B$2:$B$5,""))
Google Sheets
=TEXTJOIN(", ",TRUE,FILTER($B$2:$B$5,$A$2:$A$5="Alice"))

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1In Excel, enter =TEXTJOIN(", ",TRUE,IF(criteria_range=lookup_value,return_range,"")) and press Ctrl+Shift+Enter to confirm as an array formula (or just Enter in Excel 365).
  2. 2In Google Sheets, use FILTER instead of IF: =TEXTJOIN(", ",TRUE,FILTER(return_range,criteria_range=lookup_value)) — FILTER is native and simpler.
  3. 3The TRUE second argument in TEXTJOIN tells it to ignore blank values produced when the IF/FILTER condition is FALSE.

Tips

Need the Google Sheets version instead? Open Sheets variant in workspace →

Working on a sheet you inherited? Run the Auditor on the whole file first — it flags every #REF!, #N/A, broken column pattern, and inconsistent formula in seconds, free, no signup.

Frequently asked

Can I sort the concatenated results alphabetically?

In Google Sheets wrap the FILTER in SORT: =TEXTJOIN(", ",TRUE,SORT(FILTER(B2:B100,A2:A100=lookup_value))). In Excel 365 use =TEXTJOIN(", ",TRUE,SORT(FILTER(B2:B100,A2:A100=lookup_value))).

More on Lookups (any direction)

See all →

Formulas used

Related tasks

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: