How do I sort these dates correctly?

thepartydj

Active Member
Joined
Sep 23, 2004
Messages
261
Office Version
  1. 365
Platform
  1. Windows
These dates and time will not sort in the correct order. The column is set to date, but it is not working. Please help. Thanks!
Jan 18, 2023 7:10am
Jan 19, 2023 10:23pm
Jan 19, 2023 3:11pm
Jan 19, 2023 3:12pm
Jan 19, 2023 5:00pm
Jan 19, 2023 5:25pm
Jan 19, 2023 5:29pm
Jan 19, 2023 5:29pm
Jan 2, 2023 5:08am
Jan 2, 2023 5:27am
Jan 2, 2023 5:41am
Jan 2, 2023 5:41am
Jan 2, 2023 5:47am
Jan 20, 2023 11:01am
Jan 20, 2023 5:05am
Jan 21, 2023 12:25am
Jan 3, 2023 5:01pm
Jan 3, 2023 5:39pm
Jan 3, 2023 5:40pm
Jan 3, 2023 6:22pm
Jan 3, 2023 8:02pm
Jan 3, 2023 8:02pm
Jan 3, 2023 8:03pm
Jan 3, 2023 8:04pm
Jan 3, 2023 8:04pm
Jan 3, 2023 8:04pm
Jan 3, 2023 8:05pm
Jan 3, 2023 8:05pm
Jan 4, 2023 10:50pm
 

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.
they are not dates - they are text

if you format the column to general - they should all change to a number - (days from 1900)

try using DATA> text to columns and see if that changes correctly to a date format
 
Upvote 0
they are not dates - they are text

if you format the column to general - they should all change to a number - (days from 1900)

try using DATA> text to columns and see if that changes correctly to a date format
Looks like it is all text. Text to column doesn't change and format doesn't change the fact that it is just text. Do I need to move the time to a different column and then try to sort? Can you help how I would do that?
 
Upvote 0
Try replacing "AM" with " AM" and "PM" with " PM"
 
Upvote 0
i had to use
=DATEVALUE(MID(A1,4,2)&" "&LEFT(A1,3)&" "&TRIM(MID(A1,8,5)))+TIMEVALUE(MID(A1,SEARCH(":",A1,1)-2,2)&":"&MID(A1,SEARCH(":",A1,1)+1,2)&" "&RIGHT(A1,2))

Book4
AB
1Jan 18, 2023 7:10am01/01/2023 7:10 am
2Jan 19, 2023 10:23pm01/01/2023 10:23 pm
3Jan 19, 2023 3:11pm01/01/2023 3:11 pm
4Jan 19, 2023 3:12pm01/01/2023 3:12 pm
5Jan 19, 2023 5:00pm01/01/2023 5:00 pm
6Jan 19, 2023 5:25pm01/01/2023 5:25 pm
7Jan 19, 2023 5:29pm01/01/2023 5:29 pm
8Jan 19, 2023 5:29pm01/01/2023 5:29 pm
9Jan 2, 2023 5:08am02/01/2023 5:08 am
10Jan 2, 2023 5:27am02/01/2023 5:27 am
11Jan 2, 2023 5:41am02/01/2023 5:41 am
12Jan 2, 2023 5:41am02/01/2023 5:41 am
13Jan 2, 2023 5:47am02/01/2023 5:47 am
14Jan 20, 2023 11:01am02/01/2023 11:01 am
15Jan 20, 2023 5:05am02/01/2023 5:05 am
16Jan 21, 2023 12:25am02/01/2023 12:25 am
17Jan 3, 2023 5:01pm03/01/2023 5:01 pm
18Jan 3, 2023 5:39pm03/01/2023 5:39 pm
19Jan 3, 2023 5:40pm03/01/2023 5:40 pm
20Jan 3, 2023 6:22pm03/01/2023 6:22 pm
21Jan 3, 2023 8:02pm03/01/2023 8:02 pm
22Jan 3, 2023 8:02pm03/01/2023 8:02 pm
23Jan 3, 2023 8:03pm03/01/2023 8:03 pm
24Jan 3, 2023 8:04pm03/01/2023 8:04 pm
25Jan 3, 2023 8:04pm03/01/2023 8:04 pm
26Jan 3, 2023 8:04pm03/01/2023 8:04 pm
27Jan 3, 2023 8:05pm03/01/2023 8:05 pm
28Jan 3, 2023 8:05pm03/01/2023 8:05 pm
29Jan 4, 2023 10:50pm04/01/2023 10:50 pm
Sheet2
Cell Formulas
RangeFormula
B1:B29B1=DATEVALUE(MID(A1,4,2)&" "&LEFT(A1,3)&" "&TRIM(MID(A1,8,5)))+TIMEVALUE(MID(A1,SEARCH(":",A1,1)-2,2)&":"&MID(A1,SEARCH(":",A1,1)+1,2)&" "&RIGHT(A1,2))
 
Upvote 0
I ended up using text to columns to split the month-day and time. Then I formated Month-day to date, and time to time and left them seperate.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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