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

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
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,226,735
Messages
6,192,733
Members
453,752
Latest member
Austin2222

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