LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default return cardinal number from ordinal number function - an example

No question here, just a custom function for the archive


Return an ordinal number (e.g., 1st, 2nd, 3rd) from a cardinal number
(e.g., 1, 2, 3, etc).


Function OrdinalNumberReturn(TargetCell As String) As String
'return ordinal number (e.g. 1st,2nd,3rd) from a cardinal number
'(e.g.,1,2,3,etc).

If TargetCell = "" Then
OrdinalNumberReturn = ""
Else

Select Case Right(TargetCell, 1)

Case 1
OrdinalNumberReturn = TargetCell & "st"
Case 2
OrdinalNumberReturn = TargetCell & "nd"
Case 3
OrdinalNumberReturn = TargetCell & "rd"
Case Else
OrdinalNumberReturn = TargetCell & "th"
End Select
End If
End Function


search criteria
return ordinal number from a cardinal number
convert to ordinal number ordinal conversion
get the ordinal number evaluate for ordinal number

 
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
How to return a number instead of true/false with an if function? charles New Users to Excel 3 October 1st 09 07:50 AM
Function that can return the row number QuietMan Excel Worksheet Functions 5 August 14th 08 03:10 AM
Function to return a month name from a number (1-12) that is not a Chuck M Excel Worksheet Functions 7 July 27th 07 08:35 PM
Is there a function that will return the page number? garyme2 Excel Worksheet Functions 1 July 15th 05 12:15 AM
function to return positive number or zero Michael McClellan Excel Programming 3 July 9th 04 07:31 PM


All times are GMT +1. The time now is 07:12 AM.

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

About Us

"It's about Microsoft Excel"