Link to home
Start Free TrialLog in
Avatar of rvfowler2
rvfowler2Flag for United States of America

asked on

Excel Concatenating Addresses Without Showing Blank Fields

I have an exported Excel file with the address in 3 different columns and want to combine them into one column.  Looked up merge cells and tried it but it wasn't helpful.  Tried writing a concatenation formula and adding commas between say the address and suite number, which worked; however, I don't want to include a comma and space when the suite field is empty.  Any suggestions?
Avatar of StephenJR
StephenJR
Flag of United Kingdom of Great Britain and Northern Ireland image

Can any (all) of the three columns be blank?
SOLUTION
Avatar of sjklein42
sjklein42
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This maybe?

=TRIM(CONCATENATE(A2,IF(A2<>"",", ",""),B2,IF(B2<>"",", ",""),IF(C2<>"",C2, "")))
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of barry houdini
barry houdini
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oops, missed that. Nice work Barry.
Avatar of rvfowler2

ASKER

OK, an IF statement just like Filemaker.  This is close, but you need to account for a blank first cell as well.  Attaching file that gives all possible combos and will give credit to somone if they get it before me (though will give partial to all if you don't since you pointed me in the right direction).
-AddressConcat.xls
Figured it out.  The only change was in the first part of the calc, to put the comma (but in this case it would be a period) AFTER the cell (A2) as follows:

=SUBSTITUTE(IF(A2="","",A2&", ")&IF(B2="","",", "&B2)&IF(C2="","",", "&C2),", ","",1)

Awarding points.
Thanks.  Hope my points are fair.
Seems that you got several good solutions and picked the best one for your needs.  Works for me :)