Given a date, how do I get the day of the week (e.g. "Monday") into a cell in Excel?
feedback
|
|
Simple example: A1 cell: 1/8/2009 This will, for the given date, print the corresponding day. Is this what you wished ? | |||||||||||
feedback
|
|
Another possibility, depending on what you want to do with the date afterwards, is to set the cell's format to Custom: dddd | |||||
feedback
|
|
The answer given above is only working by fluke because 1/1/1900 was a Sunday and by default Excel is using Sunday as first day of week for the Weekday function. What you are actually calculating in that method is the day of the week as a number, then formatting that as a day based on that number interpreted as a date. Eg if your date is 1/2/2003 and you use the WEEKDAY function, this results in 7 (=Saturday). When you then format this as "dddd" you are actually getting the day name of the 7th day in Excel, ie 7/1/1900, which happens to be a Saturday. This formula will break if someone opens it who has the option selected to use the 1904-based date system, as 1/1/1904 was not a Sunday, but a Friday. (yes I know hardly anyone uses that, but you don't want to build a solution which relies on that do you?) You can make the formula shorter, faster and more robust simply by using
You could of course just format the date cells themselves with a custom format as already suggested, depending on whether you really need this in a separate column or not. I often use date formats such as
to give eg Sat 01 Feb 2003 so the date is explicit but shows the weekday name as well. Using a second column and a TEXT function is essential if you want to use the weekday explicitly somewhere in a mail merge (for example), similarly for things like currencies and so on Excel > Word merging passes the actual underlying stored value rather than the on-screen formatted version, so regardless of the cell format, Word sees some horrible number. A true text field is passed 'as is' and displays properly in Word. | |||
|
feedback
|