Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default Conditional Formatting

Hi,

You can't actually do that with straight formatting. If you enter 421st in
a cell and to format it you will need to select the st portion of the entery
and choose Format, Cells, Font tab, Superscript. Now fill it down and you
will see what Excel can do.

You could write a macro to do this, but you can't use a formula approach
because Excel does not allow you to format part of a formula.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Jokah.D" wrote:

I would like to represent numbers as placements for example: 421 becomes
421st with the "st" in superscript, 32 becomes 32nd with the "nd" in
superscript.

Is there a way to do this in Excel 2007?

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Conditional Formatting

Actually it can be done my friend. The code is as follows:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim cell As Range
Dim blank As Boolean
For Each cell In Me.Range("L3:L43")
If Application.IsNumber(cell.Value) Then
Select Case Right(cell.Value, 1)
Case 0
blank = True
Case 1
cell.Value = cell.Value & "st"
blank = False
Case 2
cell.Value = cell.Value & "nd"
blank = False
Case 3
cell.Value = cell.Value & "rd"
blank = False
Case Else
cell.Value = cell.Value & "th"
blank = False
End Select
If Not blank Then
n = cell.Characters.Count - 1
cell.Characters(n, 2).Font.Superscript = True
End If
End If
Next cell
End Sub

Thank you anyway for your reply


"Shane Devenshire" wrote:

Hi,

You can't actually do that with straight formatting. If you enter 421st in
a cell and to format it you will need to select the st portion of the entery
and choose Format, Cells, Font tab, Superscript. Now fill it down and you
will see what Excel can do.

You could write a macro to do this, but you can't use a formula approach
because Excel does not allow you to format part of a formula.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Jokah.D" wrote:

I would like to represent numbers as placements for example: 421 becomes
421st with the "st" in superscript, 32 becomes 32nd with the "nd" in
superscript.

Is there a way to do this in Excel 2007?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting cells in a column with conditional formatting? shamor Excel Discussion (Misc queries) 8 May 19th 08 10:11 PM
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 3 January 20th 07 02:02 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 0 January 15th 07 04:35 PM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM


All times are GMT +1. The time now is 11:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"