Text Functions
Intermediate

TEXTJOIN: join a row and skip the gaps

One address line from several columns, with no doubled commas where a part is missing.

Task:

The CRM stores addresses in four columns, and not every customer has a second line or a county. Build one comma-separated address in F2:F5, with no empty gaps where a part is missing.

Hints

+5 XPno-hints bonus

Solve it on your own to keep the bonus. Each hint gets one step closer to the formula.

The data in this exercise

This is the grid you start with. Cell references in the task — B6, C2 — point at the row numbers and column letters below.

5 rows × 6 columns4 cells you fill in
ABCDEF
1CustomerLine 1Line 2TownCountyAddress
2Bayliss4 Mill LaneLedburyHerefordshire
3CarrowUnit 9Riverside ParkNorwich
4Dalby12 High StFlat 2ThirskNorth Yorkshire
5ElwesThe Old ForgeRipon
What this exercise teachesMay contain the answer

Joining with & means writing every piece and every separator yourself, and a missing Line 2 leaves a stray ", ," in the middle. TEXTJOIN puts the separator only between parts that exist, which is the rule you would follow writing the address by hand.