Sorting with merged cells

levy77

Board Regular
Joined
May 7, 2019
Messages
67
Hi,

I'm trying to sort the below table on the 'OVERALL' values, the issue I'm having is that as 'OVERALL', 'M/F' ... etc are all merged. When the sort is run essentially candidate 1 with all their data is sorted against all other candidates with all their data. Maybe some way of grouping or naming the ranges to then sort on a given value in the group or range.

Does anyone have any ideas?

Admin Note: Screenshot has been removed upon member's request due to sensitive information. As it is also explained in the original question above, cells are vertically merged and table needs to be sorted properly.
 
Last edited by a moderator:

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

alansidman

Well-known Member
Joined
Feb 26, 2007
Messages
6,894
Office Version
  1. 365
Platform
  1. Windows
 

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,880
Office Version
  1. 2010
Platform
  1. Windows
You can do it with VBA. I have done it before with a sheet somewhat similar to yours. In your case, it may be necessary to convert the Excel table to range first, sort it, then, convert it back to an Excel table.

Can you write VBA scripts? If you can, here is the idea:
1. convert the Excel table to range,
2. un-merge everything,
3. insert two columns in the sheet. They can be anywhere in the sheet but it'd be easier if inserted before Col. A. I'll call them "new A" and "new B",
4. fill new A with overall,
5. fill new B with row number,
6. sort first by new A then new B. Sorting by new A is essentially sorting overall. Sorting by new B will keep the rows in its original order in the merged group.
7. re-merge cells,
8. delete new A and new B,
9. convert the range to an Excel table and it's done.
 
Last edited:
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,117
Messages
5,835,484
Members
430,358
Latest member
zzc1128

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
Top