Combining like data on a spreadsheet

2019-08-05 17:41发布

I'm not sure how I would go about creating a macro (or maybe even an Access query?) for what I'm looking at here. I have a spreadsheet of tens of thousands of customer names/numbers with product data. If a customer has bought two (or more) products, it reflects as multiple entries on the spreadsheet (example below).

Name      #      Product
----------------------------
Bob      101    Product 1
Joe      102    Product 3
Bob      101    Product 2
Bob      101    Product 3
Hank     103    Product 2
Susan    104    Product 1
Hank     103    Product 3

I want to run something on that spreadsheet that combines the entries into one line, such as the example below. I'm not concerned about how the "products" are delineated... comma, line break, space, whatever. But I would like the end result to look something like this

Name      #      Products
-----------------------------------------------
Bob      101    Product 1, Product 2, Product 3
Joe      102    Product 3
Hank     103    Product 2, Product 3
Susan    104    Product 1

But I'm not even sure where to start. Any ideas to at least get me in the right direction?

标签: excel
1条回答
女痞
2楼-- · 2019-08-05 18:22

Sort on Product within Name and in D2 (?):

=IF(A1=A2,D1&", "&C2,C2)  

in E2:

=A2<>A3.

Copy both down, select all, Copy, Paste Special, Values over the top, filter to select FALSE for ColumnE and delete all visible.

查看更多
登录 后发表回答