Concatenation based on values in a different column

klyoldham

New Member
Joined
Dec 13, 2005
Messages
5
Hello....I'm hoping someone can help me with this:

I need to concatenate data from several fields in the same column, based on the value in a separate column. The number of fields are not the same. I have a ws that looks like:

Column A Column B

10 Red
10 Yellow
12 Car
12 Truck
12 Boat
3 Apple
3 Lemon
3 Banana
3 Peach


After the concatenation I need the following:

Column A Column B

10 Red,Yellow
12 Car,Truck,Boat
3 Apple,Lemon,Banana,Peach

Is this possible? Any help would be greatly appreciated.

Thanks,
Klyoldham
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
hi - welcome to the board!
Book1
ABCDE
110Red10Red,Yellow
210Yellow12Car,Truck,Boat
312Car3Apple,Lemon,Banana,Peach
412Truck
512Boat
63Apple
73Lemon
83Banana
93Peach
Sheet3


formula is:

=SUBSTITUTE(TRIM(MCONCAT(IF($A$1:$A$9=D1,$B$1:$B$9,"")," "))," ",",")

..which needs to be entered with control + shift + enter, not just enter.

mconcat() is from the morefunc addin, so you'll need to download & instll it - see the recommended addins thread at the top of the board.
 
Upvote 0
getting an error

Thank you so much for your reply.

When I press ctrl+shift+enter I get an error.

"The formula you typed contains an error"

Click ok and the section that is highlighted is: D1,$B$1

Do you have any ideas what may be causing this????

Thanks again!
Klyoldham
 
Upvote 0
1) Did you download & install the html maker addin? (It should show up & be selected in tools | addins)

2) Post the exact formula you're trying to enter.
 
Upvote 0
Yes, I installed HTML Maker.

I'm using the formula you provided:
ConcatTest.xls
ABCDE
110Red=SUBSTITUTE(TRIM(MCONCAT(IF($A$1:$A$9=D1,$B$1:$B$9,"")," "))," ",",")
210Yellow
312Car
412Truck
512Boat
63Apple
73Lemon
83Banana
93Peach
10
Sheet1
 
Upvote 0
odd - formula is syntactically correct, so you shouldn't get errors when entering ?!?
 
Upvote 0
So now, after I click CTRL+SHIFT+ENTER I get the error and I click Yes. I then select Tools->Error Checking. Goes through and says that Error Checking is complete. Now I have the {} around the formula, but no values appear in the cell. Just the formula. I'm stumped!
ConcatTest.xls
ABCDE
110Red10{=SUBSTITUTE(TRIM(MCONCAT(IF($A$1:$A$9=D1,$B$1:$B$9,"")," "))," ",",")}
210Yellow
312Car12
412Truck
512Boat
63Apple3
73Lemon
83Banana
93Peach
Sheet1
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,749
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