I have a worksheet of around 750 rows, each row having a time, accurate to the tenth of a second, and falling anywhere between 10 seconds and 9 minutes . I need to be able to sort the worksheet by the 'Time' column, however my problem was that, for reasons it would take me a long time to explain here, the times below 1 minute e.g. 53.4 seconds had to be displayed in exactly that format (53.4, not 00:53.4 "mm:ss.0"). However for the times above or equal to a minute, these do need to be formatted as mm:ss.0 This means I essentially have a list where excel thinks some of the values are numbers, and some of the values are times but needed to work out how to sort it correctly. For example this list:
5:00.1, 1:45.6, 9.3, 9:13.4, 34.5, 1.8 would be sorted into this: 1.8, 9.3, 34.5, 1:45.6, 5:00.1, 9:13.4
I have come up with a long winded method I feel will be able to be simplified, but it seems to work. Any input or suggestions would be appreciated.
The times are in column A, with the column cells formatted as "general". I next added a 'number column' in column B referencing column A but formatted as "number". This was to to convert the times of a minute or more to their time code value e.g. if there is the time 1:12.4 in a row in column A, that becomes 0.000837963 in column B but 59.6 for example remains as 59.600000000. In column C I then came up with this mean looking formula:
=ROUNDDOWN(IF(D2>=60,D2/60,D2),0)&IF(D2>=60,":",".")&IF(D2>=60,RIGHT(IF(IF(MID(A2,LEN(A2)-1,1)=".",
0,ROUND((VALUE(IF(B2>1,A2/86400,A2))*1433.3333333),0))=0,TEXT(IF(IF(B2>1,A2/86400,A2<60,IF(B2>1,A2/86400,A2),""),"ss.0")
,IF(MID(A2,LEN(A2)-1,1)=".",0,ROUNDDOWN((VALUE(IF(B2>1,A2/86400,A2))*1433.3333333),0))&":"&TEXT(IF(IF(B2>1,A2/86400,A2<60
,IF(B2>1,A2/86400,A2),""),"ss.0")),4),RIGHT(IF(IF(MID(A2,LEN(A2)-1,1)=".",0,ROUND((VALUE(IF(B2>1,A2/86400,A2))*1433.3333333),0))
=0,TEXT(IF(IF(B2>1,A2/86400,A2<60,IF(B2>1,A2/86400,A2),""),"ss.0"),IF(MID(A2,LEN(A2)-1,1)=".",0,ROUNDDOWN((VALUE(IF
(B2>1,A2/86400,A2))*1433.3333333),0))&":"&TEXT(IF(IF(B2>1,A2/86400,A2)<60,IF(B2>1,A2/86400,A2),""),"ss.0")),1))
Finally I put this formula into column D: =IF(A2<1,A2*86400,A2)
Sorting A1:D750 by column D, which is essentially a 'seconds' column (and hiding columns B,C, and D) this method seems to work in Excel 2013 as I intended, but i got a feeling i've massively over complicated the long formula in column C and it would be cool to find a method without so many helper columns needed
Bookmarks