Sort Multiple Rows with Custom Sort Order

mharper90

Board Regular
Joined
May 28, 2013
Messages
117
Office Version
  1. 365
Platform
  1. MacOS
I'm trying to sort ws1 (data starts in row 7) using a custom sort in one of the columns, and normal ascending sorting in some others.

The data needs to stay together in each row.
The set of data is a list of names in column B. These should be sorted alphabetically. There are several duplicate names.
The first instance of a name will either have "YES", "NO", or "MDR" in column A.
Each additional duplication of the same name will have "DPL" in column A. I want all "DPL"s of the same name to be after the first instance ("YES", "NO", or "MDR") in the sort order.
Lastly, I want the "DPL"s to be sorted chronologically based on the date in column C.


I've provided a little example to show you what I'm looking to do. I'm having trouble wrapping my head around how to do this properly. Also, since I think the above list is a little complicated, I added a quick summary below that might make the most sense while looking at the sample table.

First priority is names in alphabetical order.
Then the first instance of each name ("YES", "NO", or "MDR") appears higher on the list than the duplicates "DPL"s of the same name.
Lastly, all "DPL"s of the same name should be sorted chronologically.

[TABLE="width: 500"]
<tbody>[TR]
[TD]Column A ("YES", "NO", "MDR", or "DPL")[/TD]
[TD]Column B (Names)[/TD]
[TD]Column C (Dates)[/TD]
[/TR]
[TR]
[TD]NO[/TD]
[TD]Bill[/TD]
[TD]4/1/2018[/TD]
[/TR]
[TR]
[TD]DPL[/TD]
[TD]Bill[/TD]
[TD]6/14/2018[/TD]
[/TR]
[TR]
[TD]DPL[/TD]
[TD]Bill[/TD]
[TD]7/2/2018[/TD]
[/TR]
[TR]
[TD]YES[/TD]
[TD]Mark[/TD]
[TD]3/3/2018[/TD]
[/TR]
[TR]
[TD]DPL[/TD]
[TD]Mark[/TD]
[TD]3/26/2018[/TD]
[/TR]
[TR]
[TD]MDR[/TD]
[TD]Peter[/TD]
[TD]3/29/2018[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Sort Column A A to Z
Sort Column B with Custom List YES,NO,MDR,DPL
Sort Column C A to Z
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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