VBA: Combine Rows Based on Criteria

thes4s67

Board Regular
Joined
Aug 17, 2015
Messages
186
How would I be able to combine cells based on criteria? For example, if cells in column A are the same and if cells in Column B are the same combine cells in C and D.

Here is the sample data:

ABCDEFG
1Test1BlueSomething1Cool1
2Test1BlueSomething2Cool2
3Test2OrangeSomething3Cool3
4Test3RedSomething4Cool4
5Test3GreenSomething5Cool5
6Test4GraySomething6Cool6
7Test4GraySomething7Cool7

<tbody>
</tbody>


So based on the example, combine only C1 & C2 and D1 & D2 and C6 & C7 and D6 & D7.

The output should be in the cell directly below the last same row and have a delimiter.

So for example, directly below row 2 the output should look like:

ABCD
1
2
3Test1BlueSomething1|Something2Cool1|Cool2
4

<tbody>
</tbody>


Thank you.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,215,459
Messages
6,124,944
Members
449,198
Latest member
MhammadishaqKhan

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