+ Reply to Thread
Results 1 to 13 of 13

Sorting a mixture of times & 'times as text' in the same column

  1. #1
    Registered User
    Join Date
    09-01-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    11

    Sorting a mixture of times & 'times as text' in the same column

    Hi

    I have bought together a number of worksheets containing lists of times into a new worksheet by cutting & pasting & now want to sort the complete aggregated list of times, smallest to largest, with anything that looks like a number, being sorted as a number.

    All this works fine for the first 500 or so, but then a single set of times, ( some are text with apostrophe, some are just numbers ) do not sort & just sit at the end of the list in their own.

    Example
    the following are the last few items in the column that sort ok regardless of their format.
    00:57:53
    00:58:11
    00:58:13
    '66.15
    '72:08

    Next come a whole series of numbers, some formatted as text with apostrophe, others just numbers & they are not sorted 'into' the rest of the column but sit at the bottom of it.

    '32.45
    33.15
    33.16
    33.49
    '34.00

    I have tried 'format cells' & choosing the custom hh:mm as the required format for the whole column, but this does weird things to some of the numbers, so its no good. I presume I need one of the conversion formulas, but haven't been able to figure out which one I need.

    I dont really care whether the column ( once its been reformatted or converted ) contains text or numbers, but just care that anything that looks like a number is sorted as if it were a number.
    Any ideas how I can achieve this ?

    Many Thanks
    Attached Files Attached Files
    Last edited by shawfield; 03-22-2013 at 12:21 PM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Sorting a mixture of times & 'times as text' in the same column

    If you attach a file with examples of the range of values that you start with (even if it's just the column of "times"), then it will be much easier to help you.

    Pete

  3. #3
    Registered User
    Join Date
    09-01-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Sorting a mixture of times & 'times as text' in the same column

    Cheers...done

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Sorting a mixture of times & 'times as text' in the same column

    Those "times" at the bottom have decimal points instead of colons and are in text format - are they meant to represent hh:mm or mm:ss (like the earlier times)?

    Pete

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Sorting a mixture of times & 'times as text' in the same column

    Put this formula in a cell on row 2 (I used F2, but you might have other data there in your real file):

    =IF(ISNUMBER(E2),IF(E2<1,E2,--("00:"&SUBSTITUTE(TEXT(E2,"00.00"),".",":"))),--("00:"&SUBSTITUTE(E2,".",":")))

    Format that cell with a custom format of [mm]:ss, then copy down to the bottom of your data.

    You can then include that column within your sort area and sort on that field, or you could fix the values in that column and then copy/paste over the values that you have in column E, and then sort as before. The new field could then be deleted.

    Hope this helps.

    Pete

  6. #6
    Registered User
    Join Date
    09-01-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Sorting a mixture of times & 'times as text' in the same column

    ok thanks for that will give it a go

  7. #7
    Registered User
    Join Date
    09-01-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Sorting a mixture of times & 'times as text' in the same column

    Very grateful. It worked very well.
    Cheers

  8. #8
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Sorting a mixture of times & 'times as text' in the same column

    Hi shawfield

    Try the following in F2 and copy down. Format as "[m]:ss"
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Regards Kevin


    Merged Cells (They are the work of the devil!!!)

  9. #9
    Registered User
    Join Date
    09-01-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Sorting a mixture of times & 'times as text' in the same column

    Hi sorry about this...more problems with runners time data ( different data formats )

    See attached. From row 157 onwards the time data appears to be formatted wierdly I cant change the format to the required 'hh:mm:ss' time format.
    Its showing as 'HH:MM.00' a strange format I've never seen before that I cant get rid of. Thus the great formula you sent will not work on it.

    Any thoughts ?

    Cheers
    Attached Files Attached Files

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Sorting a mixture of times & 'times as text' in the same column

    That time, i.e. 02:44.42 in D92 actually represents 2 minutes and 44.42 seconds, whereas I think it is meant to represent 2 hours 44 mins and 42 seconds. To convert it you could use this formula (e.g. in G92):

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Format that cell as hh:mm:ss, then copy the formula down as required.

    Hope this helps.

    Pete

  11. #11
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Sorting a mixture of times & 'times as text' in the same column

    Hi shawfield

    Select the D157:D199. Then find and replace: Find "." Replace: ":" (without the quotes)

  12. #12
    Registered User
    Join Date
    09-01-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Sorting a mixture of times & 'times as text' in the same column

    Thanks to both for help. Am trying to sort it now
    Cheers

  13. #13
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Sorting a mixture of times & 'times as text' in the same column

    In addition you have a few bogies in your data.
    e.g. D47 has a leading space, and D188 has no colons it has 3 dots.

    This might help if you are using 2003 as your profile states.
    In G2 Drag/Fill Down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    In H2 Drag/Fill Down, Petes' suggestion.
    =IF(G2>0.1,G2,INT(G2*60*60*24)/60/24+MOD(G2*60*60*24,1)*100/60/60/24)

    If you are using 2007 or above as per your sample workbook you can do without the helper if you are into big formulae.

    See this workbook

    It assumes, as Pete does, that 02:44.42 is 2 hours 44 mins and 42 secs, and not 2 hours and 44.42 mins.
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1