How to Return Multiple Matching Values with TEXTJOIN and FILTER in Excel
Question details
The user needs a lookup formula that returns multiple matching values combined into a single cell, but their current attempt results in a #VALUE! error.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Looking up data across tables where a single or multiple criteria match several records (e.g., retrieving multiple server associations for a specific service in Table A from Table B).
- Observed behavior
- The current formula fails and returns a #VALUE! error instead of outputting the combined list of matching records.
Ensure you are using a modern spreadsheet version (like Microsoft 365, Excel 2021, or WPS Office) that supports dynamic array functions, as older versions do not support the FILTER function.
Use TEXTJOIN and FILTER to Combine Multiple Matches
By nesting the FILTER function inside TEXTJOIN, you can extract all matching values based on your criteria and merge them into a single, clean text string.
The FILTER function is used to extract an array of data that meets one or more conditions. Once the array of matching values is returned, the TEXTJOIN function strings them together, separated by a delimiter of your choice, such as a comma and a space.
Click on the cell where you want the combined list of matching values to appear (for example, cell C2 in Table A).
Start by typing the FILTER function to retrieve the matching items. To match multiple conditions, multiply the criteria arrays together: `FILTER('Table B'!$C$2:$C$100, ('Table B'!$A$2:$A$100=A2)*('Table B'!$B$2:$B$100=B2), "")`. The empty quotes at the end serve as the 'if_empty' argument to prevent calculation errors if no matches exist.
Wrap your FILTER formula inside the TEXTJOIN function to combine the results. Type `=TEXTJOIN(", ", TRUE, ` before the FILTER function and add a closing parenthesis at the end. The "TRUE" argument tells Excel to ignore any blank values in the results.
Press Enter to apply the formula. Click the bottom-right corner of the cell and drag the fill handle down to apply this lookup formula to the rest of your rows.

Effortlessly Manage Data Arrays with WPS Spreadsheet
WPS Office provides robust support for modern dynamic array functions, including TEXTJOIN and FILTER. You can seamlessly perform complex lookups, analyze data, and manage large datasets completely free of charge.
- 1. Open your dataset: Launch WPS Spreadsheet and open the workbook containing your lookup tables.
- 2. Input the formula: Select the target cell and enter the combined formula: `=TEXTJOIN(", ", TRUE, FILTER(return_range, criteria_range=criteria, ""))`.
- 3. Apply to multiple rows: Press Enter to see the combined results, then drag the fill handle down to apply the lookup formula to other cells easily.

Frequently Asked Questions
Why does my TEXTJOIN and FILTER formula return a #CALC! error?
A #CALC! error occurs when the FILTER function finds no matches and doesn't have a defined 'if_empty' argument. You can fix this by adding an empty string "" as the final argument in the FILTER function.
Can I look up multiple matches based on two different conditions?
Yes, you can multiply your criteria arrays inside the FILTER function to create AND logic. For example, `(Range1=Criteria1)*(Range2=Criteria2)` filters out only the values that meet both conditions before they are joined by TEXTJOIN.
Why is my formula returning a #VALUE! error?
A #VALUE! error typically means that the range arrays inside your FILTER function are not exactly the same size. Make sure your lookup ranges (e.g., A2:A100 and C2:C100) have the same number of rows. It can also occur if you are using an older Excel version that doesn't support these dynamic array functions.




