Spreadsheet Practice

How to add st, nd, rd and th to numbers in Excel

Formula (Excel and Google Sheets)

=A2&IF(AND(MOD(A2,100)>=11,MOD(A2,100)<=13),"th",CHOOSE(MIN(MOD(A2,10)+1,5),"th","st","nd","rd","th"))

Use "th" for 11 to 13, otherwise pick the suffix from the last digit: =A2&IF(AND(MOD(A2,100)>=11,MOD(A2,100)<=13),"th",CHOOSE(MIN(MOD(A2,10)+1,5),"th","st","nd","rd","th")).

Result on the example
one result per row in B2, filled down to B12
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in B2, filled down to B12. Change any input and the result updates, or edit the formula to experiment.

How it works

The last digit decides the suffix: MOD(A2,10) is 1 for "st", 2 for "nd", 3 for "rd", and anything else is "th". CHOOSE picks from the list (MIN caps the position at 5 so 4 to 9 all land on "th"). The exception is checked first: numbers ending in 11, 12 or 13, like 112, always take "th".

=A2&IF(AND(MOD(A2,100)>=11,MOD(A2,100)<=13),"th",CHOOSE(MIN(MOD(A2,10)+1,5),"th","st","nd","rd","th"))

Result"1st"

  1. A21

    The value in A2.

  2. MOD(A2,100)1

    MOD: Remainder after division.

    • numberA21
    • divisor100
  3. MOD(A2,100)>=11FALSE

    The >= operator tests at least.

  4. MOD(A2,100)1

    MOD: Remainder after division.

    • numberA21
    • divisor100
  5. MOD(A2,100)<=13TRUE

    The <= operator tests at most.

  6. AND(MOD(A2,100)>=11,MOD(A2,100)<=13)FALSE

    AND: TRUE if every argument is true.

    • logical1MOD(A2,100)>=11FALSE
    • logical2MOD(A2,100)<=13TRUE
  7. MOD(A2,10)1

    MOD: Remainder after division.

    • numberA21
    • divisor10
  8. MOD(A2,10)+12

    The + operator adds.

  9. MIN(MOD(A2,10)+1,5)2

    MIN: Smallest number.

    • number1MOD(A2,10)+12
    • number25
  10. CHOOSE(MIN(MOD(A2,10)+1,5),"th","st","nd","rd","th")"st"

    CHOOSE: Picks a value by its position in the list.

    • index_numMIN(MOD(A2,10)+1,5)2
    • value1"th"
    • value2"st"
    • value2"nd"
    • value3"rd"
    • value4"th"
  11. IF(AND(MOD(A2,100)>=11,MOD(A2,100)<=13),"th",CHOOSE(MIN(MOD(A2,10)+1,5),"th","st","nd","rd","th"))"st"

    IF: Returns one value if a test is true, another if false.

    • logical_testAND(MOD(A2,100)>=11,MOD(A2,100)<=13)FALSE
    • value_if_true"th"not used
    • value_if_falseCHOOSE(MIN(MOD(A2,10)+1,5),"th","st","nd","rd","th")"st"
  12. A2&IF(AND(MOD(A2,100)>=11,MOD(A2,100)<=13),"th",CHOOSE(MIN(MOD(A2,10)+1,5),"th","st","nd","rd","th"))"1st"

    The & operator joins as text.

In Google Sheets

The same formula works in Google Sheets: =A2&IF(AND(MOD(A2,100)>=11,MOD(A2,100)<=13),"th",CHOOSE(MIN(MOD(A2,10)+1,5),"th","st","nd","rd","th")). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=A2&IF(OR(AND(MOD(A2,100)>=11,MOD(A2,100)<=13),MOD(A2,10)=0,MOD(A2,10)>3),"th",CHOOSE(MOD(A2,10),"st","nd","rd"))1st, 2nd, 3rd…The same rule written the other way round: list every "th" case, and CHOOSE only handles 1, 2 and 3.

Common mistakes

  • Testing only the last digit gives "11st", "12nd" and "13rd". The MOD(A2,100) check fixes that.
  • The result is text. Keep the number for sorting and math.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Add st, nd, rd and th to numbers

In B2, turn the number into an ordinal (1st, 2nd, 3rd, 4th…) and fill down to B12. Remember that 11, 12 and 13 end in "th".

Questions

How do I write a date like "March 1st"?

Apply the formula to the day: =TEXT(B2,"mmmm ")&DAY(B2)&IF(AND(MOD(DAY(B2),100)>=11,MOD(DAY(B2),100)<=13),"th",CHOOSE(MIN(MOD(DAY(B2),10)+1,5),"th","st","nd","rd","th")).

Does it work in Google Sheets?

Yes, the same formula works.

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.