Merge all cells before an empty cell in a column

sabrez

New Member
Joined
Oct 25, 2017
Messages
12
Hi

I have the below table:

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]OrderID[/TD]
[TD]Price[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]$18[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]$18[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]$18[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]$16[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]$20[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]$12[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]$12[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]$12[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Now, I want to merge values in the column Price for duplicate values in Order ID, like below:

[TABLE="class: grid, width: 107"]
<tbody>[TR]
[TD="align: center"]OrderID[/TD]
[TD="align: center"]Price[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]$18[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]$16[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]$20[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]$12[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[/TR]
</tbody>[/TABLE]

Please suggest how.


Regards
Sabrez
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Is :
[TABLE="class: grid, width: 107"]
<tbody>[TR]
[TD="align: center"]OrderID[/TD]
[TD="align: center"]Price[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]$18[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]$16[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]$20[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]$12[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[/TR]
</tbody>[/TABLE]

Realy needed?
Wouldn't:
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]OrderID[/TD]
[TD]Price[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]$18[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]$16[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]$20[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]$12[/TD]
[/TR]
</tbody>[/TABLE]

be enough?

If so, use remove duplicates from data ribbon.


First effect could be obtained with helper column with formula (in C2):
Code:
=if(A2=A1,"",B2)
Copy this formula down,
copy column C
and paste special as values to column B
[TABLE="class: grid, width: 107"]
<tbody>[TR]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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