I have a spreadsheet with address information, with columns for Address Line 1, Address Line 2, City, State, and ZIP. I'd like to combine each of the columns into a single, formatted column, with line breaks in the address as follows:
Address Line 1 (break)
Address Line 2 (break)
City, State ZIP-ZIP2
(Some cases don't have ZIP2--it's those additional 4 numbers at the end of some ZIP codes)
This is the code I came up with:
=AH2&CHAR(10)&AI2&CHAR(10)&AJ2&", "&AK2&" "&AL2&IF(AM2="","","-"&AM2)
The code works wonderfully for cases that have data in each of those cells. It does not work so wonderfully for those that have nothing in Address Line 2; the result is simply a blank line in the address.
What I'd like to do, then, is have conditional line breaks. I can't figure out how to get it to work, though. Here's the conditional code I came up with (that isn't working):
=AH6&IF(AI6="","",CHAR(10)&AI6)&CHAR(10)&AJ6&", "&AK6&" "&AL6&IF(AM6="","","-"&AM6)
The above code works great for cases that have nothing in Address Line 2, but for cases that do, it simply cuts those addresses off after Address Line 2.
Any help you could provide would be greatly appreciated.
Address Line 1 (break)
Address Line 2 (break)
City, State ZIP-ZIP2
(Some cases don't have ZIP2--it's those additional 4 numbers at the end of some ZIP codes)
This is the code I came up with:
=AH2&CHAR(10)&AI2&CHAR(10)&AJ2&", "&AK2&" "&AL2&IF(AM2="","","-"&AM2)
The code works wonderfully for cases that have data in each of those cells. It does not work so wonderfully for those that have nothing in Address Line 2; the result is simply a blank line in the address.
What I'd like to do, then, is have conditional line breaks. I can't figure out how to get it to work, though. Here's the conditional code I came up with (that isn't working):
=AH6&IF(AI6="","",CHAR(10)&AI6)&CHAR(10)&AJ6&", "&AK6&" "&AL6&IF(AM6="","","-"&AM6)
The above code works great for cases that have nothing in Address Line 2, but for cases that do, it simply cuts those addresses off after Address Line 2.
Any help you could provide would be greatly appreciated.