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.

HarryAC
DA
PC
KA
StuDA
KA
NeenaPC
PihuKA
NA
RE
PK
KennyNE
RA
TE

<colgroup><col style="width:48pt" span="2" width="64"> </colgroup><tbody>
</tbody>

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

Please help me
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Thanks AhoyNC,this is awesome but in this trick i can concatenate only two column but i need to put together first column with second column till next first column has next text.
[h=3][/h]
 
Upvote 0
Your question is not entirely clear, but let me take a guess at what you want. Assuming "Harry" and "AC" are in Row 1, put this formula in cell C1 and copy it down...

=LOOKUP("zzzzzzz",A$1:A1,A:A)&" "&B1
 
Upvote 0
Oh Thanks Mr.rick,,, you formula works perfectly. but i need table a below.

ABCD
With you farmulaNeed like
HarryACHarry ACHarry AC,DA,PC,KA
DAHarry DA
PCHarry PC
KAHarry KA
StuDAStu DAStu DA,KA
KAStu KA
NeenaPCNeena PCNeena PC
PihuKAPihu KAPihu KA,NA,RE,PK
NAPihu NA
REPihu RE
PKPihu PK
KennyNEKenny NEKenny NE,RA,TE
RAKenny RA
TEKenny TE

<colgroup><col style="width:86pt" span="7" width="114"> </colgroup><tbody>
</tbody>
 
Upvote 0
You are going to need a macro in order to do that...

Code:
Sub NameAndCharacters()
  Dim X As Long, Rws As Variant, Cell As Range, Nmes As Range
  Set Nmes = Range("A1:A" & Cells(Rows.Count, "B").End(xlUp).Row).SpecialCells(xlConstants)
  ReDim Rws(1 To Nmes.Count + 1)
  For Each Cell In Nmes
    X = X + 1
    Rws(X) = Cell.Row
  Next
  Rws(UBound(Rws)) = Cells(Rows.Count, "B").End(xlUp).Row + 1
  For X = LBound(Rws) To UBound(Rws) - 1
    If Rws(X + 1) - Rws(X) = 1 Then
      Cells(Rws(X), "C") = Cells(Rws(X), "A") & " " & Cells(Rws(X), "B")
    Else
      Cells(Rws(X), "C") = Cells(Rws(X), "A") & " " & Join(Application.Transpose( _
                           Cells(Rws(X), "B").Resize(Rws(X + 1) - Rws(X))), ",")
    End If
  Next
End Sub


HOW TO INSTALL MACROs
------------------------------------
If you are new to macros, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. To use the macro, go back to the worksheet with your data on it and press ALT+F8, select the macro name (NameAndCharacters) from the list that appears and click the Run button. The macro will execute and perform the action(s) you asked for. If you will need to do this again in this same workbook, and if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Upvote 0
Mr.Rick you did a awesome trick but if i don't know Macros then it will not easy with formula ?
Because of the variability of rows between names, there can be no direct formula solution (Excel's text handling with formulas is somewhat limited and inflexible). There may be a formula type solution, but I think it would involve hand-crafted manual dragging of intermediary formulas coupled with multiple helper cells.
 
Upvote 0
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))))),"")

HarryACHarry AC DA PC KA
DA
PC
KA
StuDAStu DA KA

<tbody>
</tbody>

with my formula in C2 copied down
 
Upvote 0

Forum statistics

Threads
1,215,655
Messages
6,126,053
Members
449,283
Latest member
GeisonGDC

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