Merge Cells in a column based on merged status of another column

Jediben

New Member
Joined
Jun 18, 2014
Messages
5
Hello everyone,
I have a question regarding Merging cells within a macro, in an attempt to remove the manual process I currently have to follow.
I have a spreadsheet of multiple items, which have around 15 further variable in columns to the right.
Each item can have a different subset of these variables.
EG
Ref
Base
Date
Branch
Owner
Action
Status
10
London
01/02/2000
4
Dave
Sell
On-going
10
London
01/02/2000
4
Joe
Sell
On-going
10
London
19/02/2000
2
Joe
Buy
Complete
10
London
22/02/2000
2
Harry
Sell
On-going
20
Hull
01/02/2000
4
Dave
Sell
On-going
20
Hull
01/02/2000
4
Joe
Sell
Complete
20
Hull
01/02/2000
1
Dave
Sell
Complete
20
Hull
11/04/2000
4
Harry
Buy
On-going
20
Hull
11/04/2000
3
Harry
Buy
Complete
20
Hull
11/04/2000
4
Joe
Buy
On-going
30
Leeds
01/02/2000
2
Joe
Sell
On-going
30
Leeds
01/02/2000
2
Joe
Sell
Complete
30
Leeds
01/02/2000
4
Harry
Buy
On-going
30
Leeds
11/04/2000
1
Dave
Sell
Complete
40
Diss
01/02/2000
1
Bill
Sell
Complete
40
Diss
22/02/2000
1
Bill
Sell
Complete
I am required to merge the items in the REF column (which are unique identifiers) and then where possible merge other cells in the column where data is the same, up until the point where it is no longer the same in each row.
(Gaps would be merged but the web form doesn't like it!)
At present I have a macro which is able to merge the cells vertically where they are identical, and I can use it on the cells that I know are unique (in example above only Ref and Base but I have multiple columns in my table to with a Ref is the 'Key' and they are equally unique.)
Can anyone suggest a way I can get a macro to check the merge status of one other cell in the same row and then only merge the current cell if the other cell is merged too?
IE. Looking at Action, only merge if all other cells to the left are already merged as well?
Looking at the Date, it would first check if the Base cell on the same row is merged, and only then would it merge the cells with the same Date.
Then looking at Branch, it would only merge identical Branch cells if the Date cell to the left was merged.
Then looking at owner, only merge if the Branch to the left was merged etc etc down to Status (which should be a unique combination).
thanks

<tbody>
</tbody>
 
Last edited:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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