Solved

Excel Concatenating Addresses Without Showing Blank Fields

Posted on 2011-02-15
11
466 Views
Last Modified: 2012-05-11
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?
0
Comment
Question by:rvfowler2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 24

Expert Comment

by:StephenJR
ID: 34898521
Can any (all) of the three columns be blank?
0
 
LVL 16

Assisted Solution

by:sjklein42
sjklein42 earned 50 total points
ID: 34898541
Make the commas conditional by using the IF function, something like this:
CONCATENATE(cell1, IF( cell1 = '', '', ',' ), cell2, IF( cell2 = '', '', ',' ), cell3 )

Open in new window

0
 
LVL 22

Assisted Solution

by:rspahitz
rspahitz earned 50 total points
ID: 34898544
What formula do you have now?
What is in the 3 cells?
Where does the suite number come from?

Typically, you'd do something like this (or the corresponding CONCATENATE command):

=A1 & ", " & A2 & ", " & A3

However, to skip A2 if blank, use something like this:

=A1 & ", " & IF(A2="", "", A2 & ", ") & A3

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 24

Expert Comment

by:StephenJR
ID: 34898578
This maybe?

=TRIM(CONCATENATE(A2,IF(A2<>"",", ",""),B2,IF(B2<>"",", ",""),IF(C2<>"",C2, "")))
0
 
LVL 24

Assisted Solution

by:StephenJR
StephenJR earned 100 total points
ID: 34898620
Small change:

=TRIM(CONCATENATE(IF(A2<>"",A2&", ",""),IF(B2<>"",B2&", ",""),IF(C2<>"",C2, "")))
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 300 total points
ID: 34899492
..but that would still give you a trailing comma if, say, A2 and B2 only are populated.

Try this to avoid that

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

regards, barry
0
 
LVL 24

Expert Comment

by:StephenJR
ID: 34899908
Oops, missed that. Nice work Barry.
0
 
LVL 2

Author Comment

by:rvfowler2
ID: 34901431
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
0
 
LVL 2

Author Comment

by:rvfowler2
ID: 34901473
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.
0
 
LVL 2

Author Closing Comment

by:rvfowler2
ID: 34901501
Thanks.  Hope my points are fair.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 34901533
Seems that you got several good solutions and picked the best one for your needs.  Works for me :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question