+ Reply to Thread
Results 1 to 4 of 4

Custom formatting a number to show day# as "'st" "nd" "rd" and "th"

  1. #1
    Registered User
    Join Date
    10-31-2011
    Location
    Singapore
    MS-Off Ver
    Microsoft 365 (Windows 10)
    Posts
    65

    Custom formatting a number to show day# as "'st" "nd" "rd" and "th"

    Hi, im stumped here... how do i format a number to show the following according to its phonetic place in the month (is that how to say it?!)

    1 shows the number with "st"
    2 shows the number with "nd"
    3 shows the number with "rd"
    4-20 shows the number with "th"
    and repeat accordingly out to the 31st!

  2. #2
    Registered User
    Join Date
    10-31-2011
    Location
    Singapore
    MS-Off Ver
    Microsoft 365 (Windows 10)
    Posts
    65

    Re: Custom formatting a number to show day# as "'st" "nd" "rd" and "th"

    sorry..... I found it online ( putting it here in case anyone is wondering!)

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

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,938

    Re: Custom formatting a number to show day# as "'st" "nd" "rd" and "th"

    Here's the help file that describes all of the number formatting codes you can use in a spreadsheet. https://support.microsoft.com/en-us/...rs=en-us&ad=us

    I do not see any way to get this kind of formatting as a number format. I expect one could use a TEXT() function with appropriate logic in the format code parameter and convert the date to a text string with the appropriate text suffix, but, of course, there can be issues with dates stored as text. How important is it to get this exact display? Is it worth the effort to convert the date to text with the corresponding issues, or would it be preferable to display the date as is with one of the available built in formats?

    Edit: I see you have opted to convert to a text string.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Registered User
    Join Date
    10-31-2011
    Location
    Singapore
    MS-Off Ver
    Microsoft 365 (Windows 10)
    Posts
    65

    Re: Custom formatting a number to show day# as "'st" "nd" "rd" and "th"

    Thanks, yes its an issue as i cant sort by text. My amateur workaround is that ive set my workbook up to so that i have a data dump on one sheet that has a number column (1,2,3 etc) and and a formatted column (1st, 2nd, 3rd etc), then i have another sheet with a (prettier!) dashboard that runs a vlookup. So in there, the number is shown as formatted value its looking up. Its not ideal.... but if i need to arrange by date, i do it on the data dump sheet, and the dashboard just spits out the date as the formatted number using vlookup! If thats makes sense?

    Granted, it probably sounds a little OCD, but it helps when you just want to see a date for when something is due and its a formatted date, not just a random number. It would make sense to me, but to someone who hasnt spent a day in here, seeing nd, th, st etc.. its instantly recognisable what that number is.
    Last edited by morayman; 05-20-2024 at 04:12 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Custom formula for "subscription" calculations ("as-needed", "monthly", "annually")
    By skydivetom in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-06-2024, 05:21 PM
  2. Replies: 3
    Last Post: 09-18-2023, 10:12 AM
  3. Replies: 5
    Last Post: 02-05-2019, 12:03 AM
  4. [SOLVED] Column X-Ref list - Sheet1 Col A "pages", Col B:FL "Req" to Sheet2 ColA "req", ColB "page"
    By excel-card-pulled in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2017, 09:30 AM
  5. Replies: 3
    Last Post: 01-02-2014, 02:15 PM
  6. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  7. Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)" not working
    By redders in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2011, 03:52 PM

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