ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Date Function (https://www.excelbanter.com/excel-discussion-misc-queries/77862-date-function.html)

davids

Date Function
 
Is there a function I could use that would change a column of 1,2,3,4 etc
into a column of 1st,2nd,3rd,4th etc?

davesexcel

Date Function
 

http://tinyurl.com/z6qpd
Here's a post I hope will help you


--
davesexcel
------------------------------------------------------------------------
davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708
View this thread: http://www.excelforum.com/showthread...hreadid=523354


daddylonglegs

Date Function
 

Perhaps you only need up to 31 but this formula will convert an integer
in A1 to an ordinal number

=A1&IF(OR(MOD(A1,100)={11,12,13}),"th",CHOOSE(MIN( MOD(A1,10)+1,5),"th","st","nd","rd","th"))


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=523354


Gord Dibben

Date Function
 

davids

Copy this UDF to a general module in your workbook.

Function OrdinalNumber(ByVal Num As Long) As String
'You can call this directly from a worksheet cell, as follows:
'=OrdinalNumber(A1)
Dim n As Long
Const cSfx = "stndrdthththththth" ' 2 char suffixes
n = Num Mod 100
If ((Abs(n) = 10) And (Abs(n) <= 19)) _
Or ((Abs(n) Mod 10) = 0) Then
OrdinalNumber = Format(Num) & "th"
Else
OrdinalNumber = Format(Num) & Mid(cSfx, _
((Abs(n) Mod 10) * 2) - 1, 2)
End If
End Function


Gord Dibben MS Excel MVP

On Thu, 16 Mar 2006 15:51:27 -0800, davids
wrote:

Is there a function I could use that would change a column of 1,2,3,4 etc
into a column of 1st,2nd,3rd,4th etc?



Theo

Date Function
 
?B?ZGF2aWRz?= wrote in
:

Is there a function I could use that would change a column of 1,2,3,4
etc into a column of 1st,2nd,3rd,4th etc?




Try this one:

A1: 1st
B1: 2nd


- select A1+B1.

- Klick south-east corner and drag to C3, D3, E3....

Should result in:

row A1, B1, C1, etc...
1st 2nd, 3rd,etc..




--
Greetz, Just4fun

davesexcel

Date Function
 

davids Wrote:
Is there a function I could use that would change a column of 1,2,3,4
etc
into a column of 1st,2nd,3rd,4th etc?

It helps if you acknowlege the replies


--
davesexcel
------------------------------------------------------------------------
davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708
View this thread: http://www.excelforum.com/showthread...hreadid=523354



All times are GMT +1. The time now is 03:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com