Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default display dates with ordinal numbers in excel

I would like to display a date in the format 7th September 2006 in a cell. I
want to do this as a cell format so that I can refer to the cell and Excel
will recognise it as a date, not text.

Is there any way to show ordinal numbers in this way using cell formatting?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 44
Default display dates with ordinal numbers in excel

Use a Custom Format. Change it too dd 'mmmm yyyy' which will display
'07 September 2006'. Use 'd mmmm yyyy' for '7 September 2006'. Sorry, I
don't know how to put the 'th', 'st' or 'nd' in.

--
Dave


"Tim Green" wrote:

I would like to display a date in the format 7th September 2006 in a cell. I
want to do this as a cell format so that I can refer to the cell and Excel
will recognise it as a date, not text.

Is there any way to show ordinal numbers in this way using cell formatting?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,886
Default display dates with ordinal numbers in excel

Hi Tim

Not with formatting I'm afraid.
The nearest you can get would be FormatCellsNumberCustom d mmmm yyyy
to give you 7 September 2006.

Chip Pearson has good information on his site regarding Ordinals, both
by formula and VBA
http://www.cpearson.com/excel/ordinal.htm

You could perhaps use these methods for your display, and have the date
in ordinary format in another hidden column for use in your further data
manipulation.

--
Regards

Roger Govier


"Tim Green" wrote in message
...
I would like to display a date in the format 7th September 2006 in a
cell. I
want to do this as a cell format so that I can refer to the cell and
Excel
will recognise it as a date, not text.

Is there any way to show ordinal numbers in this way using cell
formatting?



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default display dates with ordinal numbers in excel

On Thu, 7 Sep 2006 02:46:02 -0700, Tim Green
wrote:

I would like to display a date in the format 7th September 2006 in a cell. I
want to do this as a cell format so that I can refer to the cell and Excel
will recognise it as a date, not text.

Is there any way to show ordinal numbers in this way using cell formatting?


You would have to set the cell format using an event-triggered VBA macro.

The macro below should work reliably for dates using the 1900 date system that
are on or after 1 Mar 1900. If you are using the 1904 date system, or dates
before 1 Mar 1900, it will require some additional lines due in part to the
"built-in" bug in Excel which allows 29 Feb 1900 as a valid date. (I'm told
that was done for compatibility with Lotus).

To enter this macro, right click the sheet tab and select View Code. Paste the
macro below into the window that opens.

You will have to "Set" AOI to the range that you wish to have formatted in this
manner.

Let me know if this does what you want:

=============================================
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Dim AOI As Range, c As Range
Dim Suffix As String
Dim dt As Date

Set AOI = [A2:A10] 'set to range to be formatted

For Each c In AOI

If IsDate(c) Then
dt = c.Value

Select Case Day(dt)
Case Is = 1, 21, 31
Suffix = "st"
Case Is = 2, 22
Suffix = "nd"
Case Is = 3, 23
Suffix = "rd"
Case Else
Suffix = "th"
End Select
c.NumberFormat = "d""" & Suffix & """ mmm yyyy"
End If
Next c

End Sub
=======================================


--ron
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default display dates with ordinal numbers in excel

See http://xldynamic.com/source/xld.RANK.html, might give you some help

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Tim Green" wrote in message
...
I would like to display a date in the format 7th September 2006 in a cell.

I
want to do this as a cell format so that I can refer to the cell and Excel
will recognise it as a date, not text.

Is there any way to show ordinal numbers in this way using cell

formatting?




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default display dates with ordinal numbers in excel

Thank you very much, that did the trick!

"Ron Rosenfeld" wrote:

On Thu, 7 Sep 2006 02:46:02 -0700, Tim Green
wrote:

I would like to display a date in the format 7th September 2006 in a cell. I
want to do this as a cell format so that I can refer to the cell and Excel
will recognise it as a date, not text.

Is there any way to show ordinal numbers in this way using cell formatting?


You would have to set the cell format using an event-triggered VBA macro.

The macro below should work reliably for dates using the 1900 date system that
are on or after 1 Mar 1900. If you are using the 1904 date system, or dates
before 1 Mar 1900, it will require some additional lines due in part to the
"built-in" bug in Excel which allows 29 Feb 1900 as a valid date. (I'm told
that was done for compatibility with Lotus).

To enter this macro, right click the sheet tab and select View Code. Paste the
macro below into the window that opens.

You will have to "Set" AOI to the range that you wish to have formatted in this
manner.

Let me know if this does what you want:

=============================================
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Dim AOI As Range, c As Range
Dim Suffix As String
Dim dt As Date

Set AOI = [A2:A10] 'set to range to be formatted

For Each c In AOI

If IsDate(c) Then
dt = c.Value

Select Case Day(dt)
Case Is = 1, 21, 31
Suffix = "st"
Case Is = 2, 22
Suffix = "nd"
Case Is = 3, 23
Suffix = "rd"
Case Else
Suffix = "th"
End Select
c.NumberFormat = "d""" & Suffix & """ mmm yyyy"
End If
Next c

End Sub
=======================================


--ron

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default display dates with ordinal numbers in excel

On Thu, 7 Sep 2006 08:34:02 -0700, Tim Green
wrote:

Thank you very much, that did the trick!

Glad to help. Thanks for the feedback.
--ron
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
How do I disable Excel from changing numbers with dashes to dates? iRox Excel Discussion (Misc queries) 6 November 3rd 05 10:00 AM
I don't want to display any controls in excel. areddy Excel Discussion (Misc queries) 0 October 31st 05 08:46 AM
TRYING TO SET UP EXCEL SPREADSHEET ON MY COMPUTER MEGTOM New Users to Excel 5 October 27th 05 03:06 AM
Can you display numbers as words in excel (eg. 10 as ten)? Stefan White Excel Discussion (Misc queries) 2 October 5th 05 04:38 PM
Stop Excel Rounding Dates leinad512 Excel Discussion (Misc queries) 1 April 20th 05 04:19 PM


All times are GMT +1. The time now is 02:33 PM.

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"