concatenation query

Joey Jr

New Member
Joined
Oct 31, 2002
Messages
19
Hi there,
I have a frustrating problem, to which I'm sure there must be a solution.

I have a worksheet which contains customer details. Columns G, H, I, J and K contain various parts of the customers address: Street, District, Town, County and Postcode. In Column L, I need to have the full address, with each part of the address separated by a comma, and a space. I have used the following formula:

L1=concatenate(G1", "H1", "I1", "J1", "K1)

This works fine, provided each customer has all 5 parts of the address. However I have over 27,000 rows of customer details, and some customers addresses don't contain all five parts. This proves to be a problem as the following address:
Street = 1 The Street
District = Blank
Town = London
County = Blank
Postcode = AA1 1ZZ

Appears as

1 The Street, , London, , AA1 1ZZ.

The duplicate commas being caused by the formula inserting the blank cells.

In a nutshell, I need a way to only insert the comma and space after a cell that contains data, and ignore a blank cell.

Any ideas gratefully recieved.

Cheers
Joe
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Why don't you do a "Find Replace" on your result. ie replace all instances of two commas with one.

Replace , ,
with ,
 
Upvote 0
Morning Andrew,
You would have thought that would work, but it cant seem to find any instances of this occuring, although I can plainly see them occuring on the screen. I wondered whether this was because the cells with the duplicates contain the concatenation formula, so , , is actually ,", ?

Does that make any sense?
 
Upvote 0
On 2002-11-01 07:02, Joey Jr wrote:
Morning Andrew,
You would have thought that would work, but it cant seem to find any instances of this occuring, although I can plainly see them occuring on the screen. I wondered whether this was because the cells with the duplicates contain the concatenation formula, so , , is actually ,", ?

Does that make any sense?
Copy and PasteSpecial your column of formulas to Values and then you can replace the commas the way Andrew suggested.Eli
 
Upvote 0
You could also use a formula of the following formate:

=A1&IF(LEN(B1)>0,", "&B1,B1)&IF(LEN(C1)>0,", "&C1,C1)

and so on for columns D and E

Eli
 
Upvote 0
Sweet!
Worked like a charm!
I opted for the Paste Special route, but cheers for the other solutions, as I will use them in future.

Joe
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top