concatenate rows in column

ppvtuser

New Member
Joined
May 7, 2012
Messages
5
Table 1

Name_____________Category
Macbook Air_______ Laptops
Macbook Air_______ Computers
Eeepc____________ Netbooks
Eeepc____________ Laptops

Output wanted:

Table 2

Name__________categories
Macbook Air_____Laptops, Computers
Eeepc__________Netbooks, Laptops

How do I achieve the output?
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Is there a reasonable maximum (maybe 4-5) or do you need to accomodate for an infinite number of categories?
 
Upvote 0
I broke it up into smaller pieces by creating the following measures:

Code:
Category Count:=COUNTROWS(VALUES(Table1[Category]))

Code:
Val1:=TOPN(1,VALUES(Table1[Category]),Table1[Category],1)

Code:
Val2:=IF([Category Count]>1,", "
&TOPN(1,TOPN(2,VALUES(Table1[Category]),Table1[Category],1),Table1[Category]),"")
Code:
Val3:=IF([Category Count]>2,", "
&TOPN(1,TOPN(3,VALUES(Table1[Category]),Table1[Category],1),Table1[Category]),"")
Code:
Val4:=IF([Category Count]>3,", "
&TOPN(1,TOPN(4,VALUES(Table1[Category]),Table1[Category],1),Table1[Category]),"")
Code:
Val5:=IF([Category Count]>4,", "
&TOPN(1,TOPN(5,VALUES(Table1[Category]),Table1[Category],1),Table1[Category]),"")
Code:
CategoryList:=[Val1]&[Val2]&[Val3]&[Val4]&[Val5]

This assumes that you have a relationship between Table1[Name] & Table2[Name].
Then, in Table2 add the following column:
Code:
Categories:=[CategoryList]
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

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