Re: Calculating days of week

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Norman Harker (njharker_at_optusnet.com.au)
Date: 04/19/04


Date: Mon, 19 Apr 2004 13:21:49 +1000

Hi HBYardSale!

Replies show that you have various choices.

Three approaches with selection depending upon input and subsequent
needs:

Approach 1:
=A1
Format dddd or ddd

Would be used where you want to de able to use the underlying date
later especially where instead of a reference to a date in A1, you use
a calculated date: eg

=DATE(YEAR(A1),MONTH(B1),1)
Format dddd
Returns the 1st of the month and displays as a day of week. Allows you
to use date calculations on the date stored.

Approach 2:
=TEXT(A1,"dddd")
Returns the day of week of the date in A1.

You can't do subsequent calculations with this very easily (although
you still have the ability to use the date in A1 or the calculation
used to provide the date that is used). But it might be useful for
presentation purposes eg:

=UPPER(TEXT(A1,"dddd"))
Returns the day of week in upper case.

Approach 3:
=WEEKDAY(A1)
Format ddd or dddd
Returns the day of week as a number (Sun = 1, Mon = 2 etc) but
displays as a name.

We use this especially where we want to use the day number
subsequently. eg:

=IF(WEEKDAY(A1)=1,B1*1.5,B1)
Returns B1*1.5 if A1 is a Sunday but otherwise returns B1

Incidentally, the use of WEEKDAY relies on an error which made
1-Jan-1900 a Sunday when in fact it was a Monday. The error corrects
itself after 28-Feb-1900 because in the 1900 date system they inserted
a Leap Year day which didn't exist.

-- 
Regards
Norman Harker MVP (Excel)
Sydney, Australia
njharker@optusnet.com.au
It is  imperative that the patches provided by Microsoft in its April 
Security Release be applied to Systems as soon as possible. It is 
believed that the likelihood of a worm being released SOON that 
exploits one of the vulnerabilities addressed by these patches is VERY 
HIGH.
See:
http://www.microsoft.com/security/protect/ 


Relevant Pages

  • Re: Rounding question
    ... PAD applies only on cells that have a numeric format that specifies the number of decimal places. ... PAD will permanently change any constant cell value in a cell that has a numeric format with decimal places. ... Setting PAD will round the interest rate, which can irreversibly alter every calculation that depends on that interest rate directly or indirectly. ... I'd ideally like a way of creating an invoice template to round down to 2 decimal places, or even building in a background formula that checks all calculations make sense to 2 decimal places. ...
    (microsoft.public.excel)
  • Re: Dividing hours
    ... Regardless of how complex your workbook is, hours are as simple as numbers. ... Use Excel time format. ... Then do all your calculations as numbers. ... worksheets Each workbook also has a calculation worksheet. ...
    (microsoft.public.excel.misc)
  • Re: If function confused with 0.1
    ... you need to format to 16 decimal places or more to see it that way. ... "David Biddulph" wrote: ... binary representations thereof). ... for some calculations it is giving the answer "no" when the ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Excel 2007 calculate time between 2 date/time columns
    ... you cannot format this to display what you want because Excel will not display more than 31 days in a date format. ... calculations), so still learning. ... >> Best Regards, ...
    (microsoft.public.excel.misc)
  • Re: Date Formatting
    ... I can see the absolute merit of Dave's keeping the date in a format for ... use in further calculations (how are we going to do all those SP ... >> Bob Phillips wrote: ... >>> allow cell width to cater for the full text string nullifies the ...
    (microsoft.public.excel.misc)