format cell to show 1st, 2nd, 3rd, 4th et.al.

JasonVS

New Member
Joined
Feb 11, 2005
Messages
2
How do you get excel to automatically put in the letters if the cell only will contain a number?
Have several cells with position# (1st, 2nd, 3rd) and would like to just input 1, 2, 3 and have it look like 1st, 2nd, 3rd.
Simple but can't figure it out, nor is it Googleable anywhere...
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Can you enter it in autocorrect?
tools/options/spelling/autocorrect
Then, whenver you type 1, it will automatically correct it to 1st
The only problem with the solution is it will ALWAYS do it, so if you just wanted this to apply to one column or one workbook, it won't help you.
 
Upvote 0
a good answer and a good suggestion.
Saying there is no ordinal function in Excel sets my mind at ease--I haven't missed it anywhere.

The autofill is a great idea but I need it to be only for a cell.


Want to do it all in one cell, but alas it looks impossible.

Thanks much!
 
Upvote 0
Want to do it all in one cell, but alas it looks impossible.

Suppose you want to format cell A1 of Sheet1

Try this:
1)copy the code of "Function OrdinalNumber" in a standard module
2) Copy the following code in the Sheet1 code module:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address = Range("A1").Address And _
Application.WorksheetFunction.IsNumber(Target) Then
Target = OrdinalNumber(Target)
End If
Application.EnableEvents = True
End Sub

Does it work??

Post for feedback.. ciao
 
Upvote 0
Sorry, but above code fails if the change involves a range greater than 1 cell. Copy this:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Cells.Count = 1 And Target.Address = Range("A1").Address Then
If Application.WorksheetFunction.IsNumber(Target) Then
Target = OrdinalNumber(Target)
End If
End If
Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,203,140
Messages
6,053,725
Members
444,681
Latest member
Nadzri Hassan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top