Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Conditional concatenation and commas

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Conditional concatenation and commas

BC: Try this:

=IF(OR(ISBLANK(B1),ISBLANK(C1)),CONCATENATE(B1,C1) ,CONCATENATE(B1,",",C1))

Mark

  #3   Report Post  
Posted to microsoft.public.excel.programming
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Conditional concatenation and commas


Hello Blasting Cap,

Here is another formula, This one doesn't care if "B" or "C" is blank.

=IF(AND(B1<"", C1<""), B1 & "," & C1, IF(B1="", C1, B1))

Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=47763

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatenation Muthalaly Excel Discussion (Misc queries) 2 June 24th 08 12:57 PM
Concatenation orquidea Excel Discussion (Misc queries) 6 January 11th 08 07:19 PM
So many commas Alan[_5_] Excel Worksheet Functions 2 May 24th 07 07:44 PM
Conditional concatenation? Colin Hayes Excel Worksheet Functions 1 February 13th 06 01:15 AM
Concatenation Help Henry Excel Worksheet Functions 4 December 15th 04 08:21 PM


All times are GMT +1. The time now is 04:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"