+ Reply to Thread
Results 1 to 5 of 5

Number format 1st, 2nd, 3rd etc

  1. #1
    Valued Forum Contributor
    Join Date
    06-30-2005
    Location
    Verwood, Dorset, England
    MS-Off Ver
    Excel 2000
    Posts
    479

    Number format 1st, 2nd, 3rd etc

    I am using excel 2000

    Is it possible to format numbers to be 1st, 2nd etc
    Paul

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Don't think you can without code which would change the cell value.

    Here's some links and a formula.

    http://www.cpearson.com/excel/ordinal.htm
    http://www.mvps.org/dmcritchie/excel...me.htm#ordinal
    http://xldynamic.com/source/xld.RANK.html

    =A1&CHOOSE((A1<>{11,12,13})*MIN(4,MOD(A1,10))+1,"th","st","nd","rd","th")
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Valued Forum Contributor
    Join Date
    06-30-2005
    Location
    Verwood, Dorset, England
    MS-Off Ver
    Excel 2000
    Posts
    479
    Quote Originally Posted by VBA Noob
    Don't think you can without code which would change the cell value.

    Here's some links and a formula.

    http://www.cpearson.com/excel/ordinal.htm
    http://www.mvps.org/dmcritchie/excel...me.htm#ordinal
    http://xldynamic.com/source/xld.RANK.html



    VBA Noob
    Thanks for the links

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,721
    Quote Originally Posted by VBA Noob
    =A1&CHOOSE((A1<>{11,12,13})*MIN(4,MOD(A1,10))+1,"th","st","nd","rd","th")
    You actually need an AND function in there, otherwise it won't work correctly for 12 and 13, i.e.

    =A1&CHOOSE(AND(A1<>{11,12,13})*MIN(4,MOD(A1,10))+1,"th","st","nd","rd","th")

    Also, if your numbers might be as high as 111 you need a MOD function too....so to cover all possible numbers

    =A1&CHOOSE(AND(MOD(A1,100)<>{11,12,13})*MIN(4,MOD(A1,10))+1,"th","st","nd","rd","th")

    Edit: just so that I can find this thread again if I search ....."ordinal numbers"
    Last edited by daddylonglegs; 07-13-2008 at 08:33 AM.

  5. #5
    Valued Forum Contributor
    Join Date
    06-30-2005
    Location
    Verwood, Dorset, England
    MS-Off Ver
    Excel 2000
    Posts
    479
    Quote Originally Posted by daddylonglegs
    You actually need an AND function in there, otherwise it won't work correctly for 12 and 13, i.e.

    =A1&CHOOSE(AND(A1<>{11,12,13})*MIN(4,MOD(A1,10))+1,"th","st","nd","rd","th")

    Also, if your numbers might be as high as 111 you need a MOD function too....so to cover all possible numbers

    =A1&CHOOSE(AND(MOD(A1,100)<>{11,12,13})*MIN(4,MOD(A1,10))+1,"th","st","nd","rd","th")

    Edit: just so that I can find this thread again if I search ....."ordinal numbers"
    Thanks daddylonglegs

+ 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