How to concatenate cells that meet a condition (TEXTJOIN IF)
✓ Verified in LibreOffice 25.8.7.3Build a comma-list from only the rows that match — the products in one order, the names on one team.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel | =TEXTJOIN(", ",TRUE,IF(A2:A6="East",B2:B6,"")) | The IF blanks non-matching rows; TEXTJOIN skips the blanks. In older Excel, enter with Ctrl+Shift+Enter. |
| Google Sheets | =TEXTJOIN(", ",TRUE,IF(A2:A6="East",B2:B6,"")) | Identical; =TEXTJOIN(", ",TRUE,FILTER(B2:B6,A2:A6="East")) is cleaner. |
| LibreOffice Calc | =TEXTJOIN(", ",TRUE,IF(A2:A6="East",B2:B6,"")) | Works in 25.8+; the FILTER version needs 24.8+. |
How it works
The IF runs over the whole range and returns each B value where the condition is true and "" where it isn't, producing an array like {"apple","","cherry","date"}; TEXTJOIN with its ignore-empty argument set to TRUE then glues only the real values together: "apple, cherry, date" (the West row is dropped). On modern versions TEXTJOIN(", ",TRUE,FILTER(B2:B6,A2:A6="East")) reads more clearly and does the same. This is the standard 'list all the X for each Y' pattern for turning rows into a summary cell; add more conditions by multiplying them inside the IF or FILTER.
Verified, not just documented
We ran =TEXTJOIN(", ",TRUE,FILTER(B2:B5,A2:A5="East")) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned apple, cherry, date — exactly the expected result. Every formula here is confirmed by actually executing it.