Sorting drop-down list data by Day of the week and then time

mj_bowen

Board Regular
Joined
Oct 4, 2009
Messages
103
Hi,
I have some data from two drop-down lists that I would like to sort.
The data is in two columns
1: 'Day of the week'
and
2: 'Time'
I would like to be able to sort the drop-down data so that
it is in order of days then timeslots - eg, all the Mondays in time order, followed by all the Tuesdays in time order etc.
Is this possible?
I've tried using a filter but it puts Thursday before Tuesday and doesn't always get the other days in order either.
Not sure how to solve this?

Days .png


Any suggestions would be welcomed,
kind regards,
MJ

Here is a link to the sheet:
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Like this ?

with SpreadSheet
Excel Formula:
=LET(Data,A2:B14,Days,SWITCH(A2:A14,"Monday",1,"Tuesday",2,"Wednesday",3,"Thursday",4,"Friday",5,"Saturday",6,"Sunday",7),CHOOSECOLS(SORTN(HSTACK(Data,Days),13,1,3,TRUE,2,TRUE),1,2))

or Excel
Excel Formula:
=SORTBY(E5:F17,SWITCH(E5:E17,"Monday",1,"Tuesday",2,"Wednesday",3,"Thursday",4,"Friday",5,"Saturday",6,"Sunday",7),1,F5:F17,1)

1714614717382.png
 
Upvote 0
Hi SunnyAlv,

Thank you so much for sorting this - not sure how you did it but it works!
I have added some sample pupil names to one of the sheets as my ultimate aim is to be able to
sort pupil names dependent on their day and time slots chosen - I thought I would be able to adapt but it is way beyond me!
Is this extra layer of sorting possible?
kind regards,
MJ
 
Upvote 0
Hi SunnyAlv,

Thank you so much for sorting this - not sure how you did it but it works!
I have added some sample pupil names to one of the sheets as my ultimate aim is to be able to
sort pupil names dependent on their day and time slots chosen - I thought I would be able to adapt but it is way beyond me!
Is this extra layer of sorting possible?
kind regards,
MJ
hmm, maybe that's possible, you could attach a picture/table so I can help
 
Upvote 0
Hi SunnyAlv,
Thank you so much for your 'Solution2' - I'm assuming this was you - it is exactly what I was looking for it to do, you are a legend! - apologies for not replying sooner, I've been distracted from this task but now back on it!
I will have a go at using the solution 2 on my master sheet and let you know if it works!
kind regards,
MJ
 
Upvote 0
...p.s..what would be the best way to use the solution 2 - would you have it all on one sheet and hide the columns or split it over two sheets as this demo one is set up?
 
Upvote 0

Forum statistics

Threads
1,216,499
Messages
6,131,012
Members
449,613
Latest member
MedDash99

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