View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Conditional concatenation and commas

Are you looking for a fomula in D1

=if(len(trim(B1))=0,C1,if(len(trim(C1))=0,B1,B1&", "&C1))

Assumes both B and C will not be blank.

--
Regards,
Tom Ogilvy


"Blasting Cap" wrote in message
...
I have several rows & cols in a spreadsheet that I need to concatenate
the columns for.

The source is:

A1 = Name1 B1 = 2 C1= 3
A2 = Name2 B2 = C1 = 5
A3 = Name3 B2 = 1 C1 =
A4 = Name4 B2 = 3 C1 = 2

The result would look like:

A1 = Name1 D1 = 2,3 (the concatenation of B1 & C1)
A2 = Name2 D1 = 5
A3 = Name3 D1 = 1
A4 = Name4 D1 = 3,2

Where there are 2 numbers, I want to include a comma, but where there is
one number I do not want to include a comma.

Any help appreciated.

BC