One cell listing every rep in a region (TEXTJOIN)

Hard Text
Description
Hints 0/4
Solutions 1
–
Test case
1
2
3
Reset
Submit
fx
A
B
C
D
E
F
G
1
2
3
4
5
6
7
8
9
10
Loading interactive spreadsheet...
Preparing grid cells and formula calculation engine
○ Ready Enter formula in highlighted cells, then click Submit.

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)
The exercise data, as a table
ABDE
1 RegionRepRegionEast
2 EastAdaReps
3 WestBen
4 EastCleo
5 EastDan
6 WestEli

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.

  1. Target cell is E2
  2. TEXTJOIN takes a delimiter, the ignore_empty flag, then the values
  3. Use IF to blank out the rows you do not want
  4. 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

Related practice

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.