+ Reply to Thread
Results 1 to 5 of 5

How to determine number of Saturdays in a date range?

  1. #1
    Registered User
    Join Date
    03-09-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1

    How to determine number of Saturdays in a date range?

    Hi,

    I want to determine number of saturdays in a date range, i.e if we are provided with a start date and a end date then how can we calculate the number of staurdays b/w those two days?

    Start date & End date can be a week day or a weekend.

    Please help.

    Regards,
    Casper

  2. #2
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191

    Re: How to determine number of Saturdays in a date range?

    Where A1 is start date and A2 is end date, =INT((A2-A1)/7)+IF(MOD(A2-A1,7)-WEEKDAY(A1),1,0)

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How to determine number of Saturdays in a date range?

    Courtesy of daddylonglegs.. hopefully I don't get it wrong...

    =INT((WEEKDAY(A4-7)+B4-A4)/7)

    where the Red 7 represents Saturday.. in a Week that starts off as Sunday equals 1...

    Where A4 is start and B4 is End
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: How to determine number of Saturdays in a date range?

    Quote Originally Posted by darkyam View Post
    Where A1 is start date and A2 is end date, =INT((A2-A1)/7)+IF(MOD(A2-A1,7)-WEEKDAY(A1),1,0)
    I did some testing on both solutions plus my own (see below). The above formula appears to overstate the result by 1 for ranges starting on Tuesday when the number of days is a multiple of 7, 1 added to a multiple of 7, or 1 subtracted from a multiple of 7.

    My version:

    =INT((A2-A1+WEEKDAY(A1,1))/7)
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: How to determine number of Saturdays in a date range?

    How about this:

    =0,5*(IF(WEEKDAY(B1;2)=6;2;1)+B1-A1-NETWORKDAYS(A1;B1))

    =0.5*(IF(WEEKDAY(B1,2)=6,2,1)+B1-A1-NETWORKDAYS(A1,B1))

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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