One cell listing every rep in a region (TEXTJOIN)
The problem
Problem statement
The handover note needs one line naming the reps in the region in E1. Reps are in B2:B6 with their region in A2:A6. Put the names in the Reps cell E2, separated by a comma and a space.
One formula, no helper column, and no trailing separator after the last name.
Problem data
Show the sheet as a table (selectable, copyable)
| A | B | D | E | |
|---|---|---|---|---|
| 1 | Region | Rep | Region | East |
| 2 | East | Ada | Reps | |
| 3 | West | Ben | ||
| 4 | East | Cleo | ||
| 5 | East | Dan | ||
| 6 | West | Eli |
Notes
TEXTJOIN(delimiter, ignore_empty, values) joins a list. Feeding it IF(region=target, names, "") makes a list where non-matching rows are empty strings, and ignore_empty drops them — which is why there is no trailing comma. The IF returns an array, so this needs to be entered as one in Excel 2019 and older.
How to approach
Your answer goes in E2. On submit we re-run your formula against 3 different sets of input, so a hardcoded number will fail — the formula has to follow the cells.
- Target cell is E2
TEXTJOINtakes a delimiter, the ignore_empty flag, then the values- Use
IFto blank out the rows you do not want - Shape:
=TEXTJOIN(", ", TRUE, IF(?, ?, ?))
Official solutions
Show 1 solution — try it yourself first
Approach 1: TEXTJOIN over a filtered IF
=TEXTJOIN(", ", TRUE, IF($A$2:$A$6 = E1, $B$2:$B$6, ""))
For East the IF produces {"Ada","","Cleo","Dan",""} and ignore_empty drops the blanks, leaving "Ada, Cleo, Dan". Change E1 to West and the same formula lists Ben and Eli.
Function guide
FAQ
How do I list matching values separated by commas in one cell?
=TEXTJOIN(", ", TRUE, IF(range=criteria, values, "")). The ignore_empty argument removes the rows that did not match, so no doubled or trailing delimiters appear.
Can TEXTJOIN list values filtered by two conditions?
Yes, by multiplying the conditions: IF((A2:A6="East")*(C2:C6>100), B2:B6, ""). Anything with a zero factor becomes empty and gets dropped.