CONCATENATE function

shuklaankur281190

Board Regular
Joined
Sep 30, 2014
Messages
61
Hi All,

There is a problem i am facing with CONCATENATE function. Here is in below table.

[TABLE="width: 128"]
<colgroup><col style="width:48pt" span="2" width="64"> </colgroup><tbody>[TR]
[TD="width: 64"]Harry[/TD]
[TD="width: 64"]AC[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]DA[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]PC[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]KA[/TD]
[/TR]
[TR]
[TD]Stu[/TD]
[TD]DA[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]KA[/TD]
[/TR]
[TR]
[TD]Neena[/TD]
[TD]PC[/TD]
[/TR]
[TR]
[TD]Pihu[/TD]
[TD]KA[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]NA[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]RE[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]PK[/TD]
[/TR]
[TR]
[TD]Kenny[/TD]
[TD]NE[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]RA[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]TE[/TD]
[/TR]
</tbody>[/TABLE]

I wanna add add name and his character showing in front of till second name in C column.

Please help me
 
have been playing with this for couple of hour this formula seems to work upto a limit of four instances of column B

it can be extended to include more but my coffee ran out

so stopped at your data sample

Code:
=IF(A2<>"",IF(A3<>"",CONCATENATE(A2," ",B2),IF(A4<>"",CONCATENATE(A2," ",B2," ",B3),IF(A5<>"",CONCATENATE(A2," ",B2," ",B3," ",B4),IF(A6<>"",CONCATENATE(A2," ",B2," ",B3," ",B4," ",B5),CONCATENATE(A2," ",B2))))),"")
That is a good idea you have there as long as the OP knows the maximum number of characters that a name can have and as long as that maximum is reasonably small. Two things about your formula, though... first, the delimiter between the characters should be a comma, the space is only suppose to be between the name and first character... second, my preference is not to use the CONCATENATE function, rather using the ampersand to join the text strings together. Here is your formula with both those modifications done to it...

Code:
=IF(A2<>"",IF(A3<>"",A2&" "&B2,IF(A4<>"",A2&" "&B2&","&B3,IF(A5<>"",A2&" "&B2&","&B3&","&B4,IF(A6<>"",A2&" "&B2&","&B3&","&B4&","&B5,A2&" "&B2)))),"")
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

thank you

it was a challenge for me to get that far with what i have been learning. it was an exercise for me to test my growing skills.

your feedback and example is valued and has been read several times in order to absorb, i was aware of some of the pitfalls of my method and have encountered the "&" option, on this occasion that would of probably only added to the moments of confusion in getting a working formula.

your solution is so much less complicated than mine although has elements i need to analyze more

thanks again for feedback and improvements
 
Upvote 0
If the names are in col A and the strings to concatenate in col B, copy B2 to C1 (now „AC”)
and enter into:

B2:

=IF(A2<>"",A2&" "&B2,C1&","&B2)

C2:

=IF(COUNTIF(C2,"*,*")=0,INDIRECT("C"&ROW()+COUNTIF(C$2:C20,LEFT(C2,FIND(" ",C2))&"*")-1),"")

and copy them down as long as there are data in col B. Do not change this layout. If more than 20 strings belong to some names change number 20 in C2 to a higher value.
Excel Workbook
ABCD
1AC
2HarryACHarry ACHarry AC,DA,PC,KA
3DAHarry AC,DA
4PCHarry AC,DA,PC
5KAHarry AC,DA,PC,KA
6StuDAStu DAStu DA,KA
7KAStu DA,KA
8NeenaPCNeena PCNeena PC
9PihuKAPihu KAPihu KA,NA,RE,PK
10NAPihu KA,NA
11REPihu KA,NA,RE
12PKPihu KA,NA,RE,PK
13KennyNEKenny NEKenny NE,RA,TE
14RAKenny NE,RA
15TEKenny NE,RA,TE
16BoriACBori ACBori AC,DA,PC,KA
17DABori AC,DA
18PCBori AC,DA,PC
19KABori AC,DA,PC,KA
20SomaDASoma DASoma DA,KA
21KASoma DA,KA
Sheet
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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