+ Reply to Thread
Results 1 to 3 of 3

Sorting of a Log Number that starts with a two digit year

  1. #1
    Registered User
    Join Date
    11-06-2012
    Location
    Virginia
    MS-Off Ver
    Excel 2007
    Posts
    9

    Sorting of a Log Number that starts with a two digit year

    I have a spreadsheet that I want to sort by the Log Number. The Log Number consists of a two digit year and then a sequential number: yy-### where yy is the last two digits of a year and # represents the sequential number that starts at 001 at the start of the year. The range of Log Numbers I am working with are from 99-001 to 12-071. When I try to sort it, Excel 2007 puts 99-### before/after 12-### depending on ascending or descending sort as if 99 was a number and not a year.

    I tried formatting the cells with a custom format of yy-###, but Excel won't take it.

    Is there a "custom sort" I can create (or a better custom format) that will treat the first two digits as year digits so that it sorts it properly (99, 00, 01, 02, 03,...)? I'd prefer to stay away from any VB coding, but if that's the only way to do it, I will.

    Thank you for any help.

    Bob

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Sorting of a Log Number that starts with a two digit year

    If it's just two digits in the context of nn-nnn, it IS a number, NOT a year. You'd need to include the century in order for it to come out in the order you want. You could maybe add a helper column and check the first two digits and add a century. Then sort on the helper column before the log number.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    11-06-2012
    Location
    Virginia
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Sorting of a Log Number that starts with a two digit year

    I found a workaround, I simply sorted by a specific date and then the log #. That did what I neeeded it to do.

    Thanks!

    Bob

+ 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