Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
Conditional concatenation and commas
BC: Try this:
=IF(OR(ISBLANK(B1),ISBLANK(C1)),CONCATENATE(B1,C1) ,CONCATENATE(B1,",",C1)) Mark |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Concatenation | Excel Discussion (Misc queries) | |||
Concatenation | Excel Discussion (Misc queries) | |||
So many commas | Excel Worksheet Functions | |||
Conditional concatenation? | Excel Worksheet Functions | |||
Concatenation Help | Excel Worksheet Functions |