+ Reply to Thread
Results 1 to 10 of 10

Correct Calculation for July 4th

  1. #1
    Registered User
    Join Date
    11-11-2019
    Location
    Florida
    MS-Off Ver
    too many to count
    Posts
    2

    Correct Calculation for July 4th

    hello everyone,

    the formula below calculates July 4th but it's not always correct. when it falls on Saturday, we observe it on Friday and when it falls on Sunday, we observe it on Monday.
    Independence Day -> =DATE(CalendarYear,7,4)

    what's the correct way to do it?

    for reference,

    2019 Thursday July 4, 2019 Thursday, July 4, 2019
    2020 Saturday July 4, 2020 **Friday, July 3, 2020
    2021 Sunday July 4, 2021 Monday, July 5, 2021
    2022 Monday July 4, 2022 Monday, July 4, 2022

    Thank you

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,725

    Re: Correct Calculation for July 4th

    With your years in cells A2 to A5, you can use this formula in B2:

    =DATE(A2,7,4)+IF(WEEKDAY(DATE(A2,7,4),2)=6,-1,IF(WEEKDAY(DATE(A2,7,4),2)=7,1,0))

    then copy it down to B5.

    Hope this helps.

    Pete

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Correct Calculation for July 4th

    If your year is in cell A1
    try this regular formula:
    Please Login or Register  to view this content.
    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Correct Calculation for July 4th

    Edit: Deleted as mis-understood Pete's instructions, apologies
    Last edited by WasWodge; 11-11-2019 at 09:37 PM.
    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,725

    Re: Correct Calculation for July 4th

    Ah yes, I've not used CHOOSE for a long time. A variation on Ron's formula:

    =DATE(A2,7,4)+CHOOSE(WEEKDAY(DATE(A2,7,4)),1,0,0,0,0,0,-1)

    Hope this helps.

    Pete

  6. #6
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    485

    Re: Correct Calculation for July 4th

    @ WashC:

    See if the following formula works for you:

    =WORKDAY(DATE(CalendarYear,7,3)-(WEEKDAY(DATE(CalendarYear,7,4))=7),1)

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Correct Calculation for July 4th

    Another way with years starting in A2
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dave

  8. #8
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Correct Calculation for July 4th

    Here's the problem with unusual date calcs in Excel:
    The short formulas make no sense....and pretty much all of the others make no sense, too!

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Correct Calculation for July 4th

    LOL

    Well said.

  10. #10
    Registered User
    Join Date
    11-11-2019
    Location
    Florida
    MS-Off Ver
    too many to count
    Posts
    2

    Re: Correct Calculation for July 4th

    Thank you Ron. I think yours is the one that makes the most sense to me!! lol
    All you guys got it working correctly. so ....

    THANK YOU!!!
    Last edited by WashC; 11-12-2019 at 10:12 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Assistance with correct formula/calculation please?
    By Frodoe in forum Excel General
    Replies: 2
    Last Post: 10-20-2017, 08:05 AM
  2. addition calculation not giving correct answer
    By lnjr in forum Excel General
    Replies: 2
    Last Post: 02-22-2009, 05:49 PM
  3. Can't get the correct calculation
    By bass4fam in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-02-2008, 10:54 PM
  4. Excel 2007 - Hotfix released to correct calculation bug
    By harrywaldron in forum Excel General
    Replies: 1
    Last Post: 10-11-2007, 10:28 AM
  5. [SOLVED] How do I correct this calculation?
    By Rebecca in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-23-2006, 08:04 PM
  6. 'Correct' way for multiple calculation from other worksheets?
    By Pheasant Plucker® in forum Excel General
    Replies: 1
    Last Post: 01-24-2006, 05:24 AM
  7. Calculation not correct
    By Kevin in forum Excel General
    Replies: 1
    Last Post: 07-22-2005, 02:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1