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 toB12 - 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"
A21The value in A2.
MOD(A2,100)1MOD: Remainder after division.- number
A21 - divisor
100
- number
MOD(A2,100)>=11FALSEThe >= operator tests at least.
MOD(A2,100)1MOD: Remainder after division.- number
A21 - divisor
100
- number
MOD(A2,100)<=13TRUEThe <= operator tests at most.
AND(MOD(A2,100)>=11,MOD(A2,100)<=13)FALSEAND: TRUE if every argument is true.- logical1
MOD(A2,100)>=11FALSE - logical2
MOD(A2,100)<=13TRUE
- logical1
MOD(A2,10)1MOD: Remainder after division.- number
A21 - divisor
10
- number
MOD(A2,10)+12The + operator adds.
MIN(MOD(A2,10)+1,5)2MIN: Smallest number.- number1
MOD(A2,10)+12 - number2
5
- number1
CHOOSE(MIN(MOD(A2,10)+1,5),"th","st","nd","rd","th")"st"CHOOSE: Picks a value by its position in the list.- index_num
MIN(MOD(A2,10)+1,5)2 - value1
"th" - value2
"st" - value2
"nd" - value3
"rd" - value4
"th"
- index_num
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_test
AND(MOD(A2,100)>=11,MOD(A2,100)<=13)FALSE - value_if_true
"th"not used - value_if_false
CHOOSE(MIN(MOD(A2,10)+1,5),"th","st","nd","rd","th")"st"
- logical_test
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.
| Formula | Result | When 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
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.