Forum Statistics
- Forum Members:
- Total Threads:
- Total Posts: 14
There are 1 users currently browsing forums.
|
 |

11-20-2006, 11:37 AM
|
|
Registered User
|
|
Join Date: 30 Sep 2006
Posts: 47
|
|
|
Ordinal Numbers in Dates
Please Register to Remove these Ads
Hi everyone,
I've been trying to figure out ordinal numbers in Excel, and I found information on how to turn a cardinal number into an ordinal number... but now I need to figure out if there is a way to have them take the number from a date, and return it in a date format... Like this:
A1 = 11/25/06
B1 = 25th day of November, 2006
I would appreciate any advice/assistance.
|

11-20-2006, 11:46 AM
|
|
Forum Guru
|
|
Join Date: 14 Mar 2006
Location: Pakistan
Posts: 1,799
|
|
Quote:
|
Originally Posted by OfficeBitty
Hi everyone,
I've been trying to figure out ordinal numbers in Excel, and I found information on how to turn a cardinal number into an ordinal number... but now I need to figure out if there is a way to have them take the number from a date, and return it in a date format... Like this:
A1 = 11/25/06
B1 = 25th day of November, 2006
I would appreciate any advice/assistance.
|
it would be easy if you maintain a table like this
1 January
2 February
3 March
and so on...
then use this formula (I suppose that date is entered in cell A1 and table like above for 12 months is in the range of D1:E12)
=DAY(A1)&" "&"day of "&VLOOKUP(MONTH(A1),$D$1:$E$12,2,FALSE)&", "&YEAR(A1)
you can change ranges according to your data.
Regards.
|

11-20-2006, 11:54 AM
|
 |
Forum Guru
|
|
Join Date: 25 Apr 2006
Location: London, England
MS Office Version:xl03 & xl 07(Jan 09)
Posts: 12,315
|
|
|
Hi,
or
=DAY(A1)&IF(INT(MOD(DAY(A1),100)/10)=1, "th", IF(MOD(DAY(A1),10)=1, "st", IF(MOD(DAY(A1),10)=2,"nd", IF(MOD(DAY(A1),10)=3, "rd","th"))))& " day of " & TEXT(A1,"mmmm yyyy")
VBA Noob
|

11-20-2006, 12:03 PM
|
|
Forum Guru
|
|
Join Date: 14 Mar 2006
Location: Pakistan
Posts: 1,799
|
|
for having "rd", "nd" and "th" at the end of day number.
try this
IF(RIGHT(DAY(A1),1)*1=1,"1st",IF(RIGHT(DAY(A1),1)*1=2,"2nd",IF(RIGHT(DAY(A1),1)*1=3,"3rd",DAY(A1)&"t h")))&" day of "&VLOOKUP(MONTH(A1),$D$1:$E$12,2,FALSE)&", "&YEAR(A1)
|

11-20-2006, 12:04 PM
|
|
Forum Guru
|
|
Join Date: 14 Mar 2006
Location: Pakistan
Posts: 1,799
|
|
VBA Noob's formula is good if you do not want to create table.
|

11-20-2006, 12:06 PM
|
|
Registered User
|
|
Join Date: 30 Sep 2006
Posts: 47
|
|
|
Thank you both for the advice, StarGuy & VBA Noob!
I was able to use the information you two provided to get the result that I was trying for!
|

11-20-2006, 12:07 PM
|
 |
Forum Guru
|
|
Join Date: 07 Apr 2006
Posts: 4,001
|
|
Hi,
Along side VBA Noob's formula, you can try this shorter one ...(no table)
Code:
=A1&IF(AND(A1>=10,A1<=14),"th",CHOOSE(MOD(A1,10)+1,"th","st","nd","rd","th","th","th","th","th","th"))
HTH
Carim
|

11-20-2006, 12:15 PM
|
|
Registered User
|
|
Join Date: 30 Sep 2006
Posts: 47
|
|
|
Thank you for your advice also, Carim!
I tried your formula (the no table part is always great!), but I think I might have done something wrong as the cell I put the formula into gets a thick border around it, and displays a long number... what could be causing this?
|

11-20-2006, 12:25 PM
|
 |
Forum Guru
|
|
Join Date: 07 Apr 2006
Posts: 4,001
|
|
Hi,
It is related to your own cell settings ... just format cell as you wish ...
HTH
Carim
|

11-20-2006, 12:58 PM
|
 |
Forum Guru
|
|
Join Date: 25 Apr 2006
Location: London, England
MS Office Version:xl03 & xl 07(Jan 09)
Posts: 12,315
|
|
|
Glad you got your answer
VBA Noob
|

11-20-2006, 01:30 PM
|
|
Registered User
|
|
Join Date: 30 Sep 2006
Posts: 47
|
|
|
I'm sorry Carim, I still can't seem to get your formula to work for me... I keep fiddling with my cell format, but can't get the result to change... I'll keep trying it, but in the meantime, your advice did get me thinking about using a shorter formula... I decided to use a function for making the ordinal number, and that way I could use parts of StarGuy's formula and also parts of VBA Noob's formula, and make it short like yours to get the same result.
=OrdinalNumber(DAY(A1))&" "&"day of "&TEXT(A1,"mmmm yyyy")
If you have any idea how I could be getting your formula wrong, Carim, please advise me a little further on that one. I've reformatted the cell and other cells and pasted your formula in different cells, but I can't seem to get it right.
|

11-20-2006, 01:40 PM
|
 |
Forum Guru
|
|
Join Date: 07 Apr 2006
Posts: 4,001
|
|
Hi again,
I forgot to mention that within formula A1 has to be replaced by
day(yourdate) ...
HTH
Carim
|

11-20-2006, 01:47 PM
|
|
Registered User
|
|
Join Date: 30 Sep 2006
Posts: 47
|
|
Ooh... I get it now! [sorry I am so slow] Thanks so much, Carim!
|

11-21-2006, 04:34 AM
|
 |
Forum Guru
|
|
Join Date: 07 Apr 2006
Posts: 4,001
|
|
Glad your problem is fixed
Thanks for the feedback
Carim
|
 |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|