根据其他列值合并excel行?

时间:2021-12-29 13:08:56

I'd like to do the following with VBA or just excels standard merge options if possible:

我想用VBA执行以下操作,或者如果可能的话,只需要优秀的标准合并选项:

I have the following 3 columns: https://i.imgur.com/TDdNxoq.png

我有以下3列:https://i.imgur.com/TDdNxoq.png

I what I want to do is to check whether the content of column A and B is identical, then merge both rows into one and comma separate the values in column C:

我想要做的是检查A列和B列的内容是否相同,然后将两行合并为一个,并用逗号分隔C列中的值:

https://i.imgur.com/eGm6Uj9.png

https://i.imgur.com/eGm6Uj9.png

How can I do this?

我怎样才能做到这一点?

1 个解决方案

#1


0  

I had to do something similar a while ago. Here are the steps:

我不得不做一些类似的事情。以下是步骤:

1) formula in column D:

1)D栏中的公式:

= IF (A1=B1, CONCATENATE(C1, ",", C2), "")

2) apply a filter on column D for blank cells

2)在D列上对空白单元应用过滤器

3) delete all rows that have blank column D

3)删除所有具有空白列D的行

4) remove filter

4)删除过滤器

5) delete column C

5)删除C列

Note: This is only efficient for "one time use" situations. If you need to do this often, developing a macro may be more efficient.

注意:这仅适用于“一次性使用”情况。如果您需要经常这样做,开发宏可能会更有效。

#1


0  

I had to do something similar a while ago. Here are the steps:

我不得不做一些类似的事情。以下是步骤:

1) formula in column D:

1)D栏中的公式:

= IF (A1=B1, CONCATENATE(C1, ",", C2), "")

2) apply a filter on column D for blank cells

2)在D列上对空白单元应用过滤器

3) delete all rows that have blank column D

3)删除所有具有空白列D的行

4) remove filter

4)删除过滤器

5) delete column C

5)删除C列

Note: This is only efficient for "one time use" situations. If you need to do this often, developing a macro may be more efficient.

注意:这仅适用于“一次性使用”情况。如果您需要经常这样做,开发宏可能会更有效。