View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Day of Week and Date

I can give you a VB solution that will format the cell with the display
value you want and still keep the cell value as the date you enter. However,
you will have to identify, in advance, the cell or range of cells you want
it to apply to. For example, assuming you want this display functionality to
apply to the range A1:C9 (you can change this address range inside the code
as needed), then do the following...

Right click the tab at the bottom of the worksheet where the cells A1:C9 are
located, select View Code from the popup menu that appears and Copy/Paste
the following into the code windows that opened up...

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:C9")) Is Nothing _
And IsDate(Target.Value) Then
Target.NumberFormat = "dddd mmm. d""" & _
Mid$("thstndrdthththththth", 1 - _
2 * ((Day(Target.Value)) Mod 10) * _
(Abs((Day(Target.Value)) Mod 100 - 12) 1), _
2) & """"
Else
Target.NumberFormat = "General"
End If
End Sub

Now, go back to the worksheet and type in a date in one of the cells in the
specified range... it should display as you wanted.

--
Rick (MVP - Excel)


"Té" wrote in message
...
Is there a shortcut where it puts in the day and date? like ctrl ; does
the
date, but is there an easy way where I can get the day of the week and the
month in one cell?

"Rick Rothstein" wrote:

Whoops, I forgot the period after the abbreviated month name (also, I see
the newsreader broke the formula at an awkward location...fixed in this
formula)...

=TEXT(A1, "dddd, mmm. d")&MID("thstndrdth",
MIN(9,2*DAY(A1)*(MOD(A1-11,100)2)+1),2)

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
Assuming A1 contains a real date, this formula will give you the output
you want...

=TEXT(A1, "dddd, mmm
d")&MID("thstndrdth",MIN(9,2*DAY(A1)*(MOD(A1-11,100)2)+1),2)

--
Rick (MVP - Excel)


"Té" wrote in message
...
Is there a way I can have the day of the week and the date, for
example
Tuesday Oct. 6th.