Sorting, but not ascending/descending

VBA

New Member
Joined
Jan 19, 2009
Messages
39
Heya,

I've got the following spreadsheet:

journey.jpg


As you can see, I've sorted it by column A. However, sometimes the date is the same and then it doesn't always go right... see f.ex. 17 dec, where the ship arrives in the harbour and then is at sea again and then departs :p Not exactly what happens. I had the same problem on 28 dec, but there it disappeared when I told Excel to sort secondly on column B.
However, this doesn't work for 17 dec.

So I need a way to sort such, that D always follows on A (after arrival, one departs) and S might be either after D or before A but not before D or after A... :cool: If you follow :rolleyes:

Can I do this in Sort (some sort of "custom sort") or should I write a macro for it?

Thanks in advance.
 
Thank you all, you've given me some ideas. ;)

I'll just incorperate a code if A and S or D and A fall on the same day, and make the program give an "error" or ask for help in sorting when there are 3 things happening on one day :)

And yes Andrew, that would be the best but unfortunately it's old data. For the new data this is indeed incorporated - I had those sorted out in a second :biggrin:

Thanks again for your time.
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,216,116
Messages
6,128,929
Members
449,479
Latest member
nana abanyin

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