Concatenate the cell strings

somnath_it2006

Well-known Member
Joined
Apr 11, 2009
Messages
574
Hi All,

I have below input data in my Excel Sheet:


Excel Workbook
AB
1ARed
2ABlue
3AYellow
4BPink
5BBlack
Sheet1



And I want my Output like this:

Excel Workbook
DE
1ARed - Blue - Yellow
2BPink - Black
Sheet1



So what Excel function I can use in cell - E1 to achieve the output.

Appreciate all your help.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
som i think this might be a vba problem
 
Upvote 0
On my site you'll find the user defined function =ARLOOKUP(). Excel, Lookup, Lookup several values.

Success,
Erik
 
Upvote 0
Add the following function to your workbook:
----------------------------
Function aconcat(a As Variant, Optional sep As String = "") As String
' Harlan Grove, Mar 2002
Dim y As Variant

If TypeOf a Is Range Then
For Each y In a.Cells
aconcat = aconcat & y.Value & sep
Next y
ElseIf IsArray(a) Then
For Each y In a
aconcat = aconcat & y & sep
Next y
Else
aconcat = aconcat & a & sep
End If

aconcat = Left(aconcat, Len(aconcat) - Len(sep))
End Function
----------------------------

Now you can invoke...

E1, control+shift+enter, not just enter:

=SUBSTITUTE(ACONCAT(IF($A$1:$A$5=D1," - "&$B$1:$B$5,""))," - ","",1)

 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,747
Members
448,989
Latest member
mariah3

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