Avatar of Ted Penner
Ted PennerFlag for United States of America

asked on 

Concatenate non-empty cells

This command should concatenate the cells and add a space before the next cell, but it should do this only if the cell is not empty, and this is where I am having trouble.
=CONCATENATE(AL4&", ",AM4&", ",AN4&", ",AO4)

Open in new window

ProgrammingSoftwareXMLSpreadsheetsMicrosoft Excel

Avatar of undefined
Last Comment
byundt
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of byundt
byundt
Flag of United States of America image

TEXTJOIN is the way to do it.

If you are stuck with a legacy version of Excel, you need to concatenate the results of IF functions:
=MID(IF(AL4="","",", " & AL4) & IF(AM4="","",", " & AM4) & IF(AN4="","",", " & AN4) & IF(AO4="","",", " & AO4),3,999)

Open in new window

The MID function strips the leading comma and space from the concatenated text.
Microsoft Excel
Microsoft Excel

Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.

144K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo