+ Reply to Thread
Results 1 to 11 of 11

Counting specific days between dates

  1. #1
    Registered User
    Join Date
    05-16-2013
    Location
    Hertfordshire
    MS-Off Ver
    Excel 2013
    Posts
    15

    Question Counting specific days between dates

    Hello

    I'm trying to calculate, say, the number of Tuesdays between 17/06/14 and 16/03/15. It would also be helpful if I could work out how many there are in a given month, including the dates given (especially where the start/end date falls on the specific day being counted).

    Many thanks!
    floxxie

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,936

    Re: Counting specific days between dates

    Here is a file that does just that.

    Days of specific type between two dates.xlsm
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Counting specific days between dates

    This will count the number of Tuesdays between the start date and end date (inclusive):

    Data Range
    A
    B
    C
    1
    Start
    End
    Count
    2
    6/17/2014
    3/16/2015
    39


    =INT((WEEKDAY(A2-2,2)+B2-A2)/7)

    That formula will work in any version of Excel. If you're using Excel 2010 or later then we can use this formula (fewer moving parts!):

    =NETWORKDAYS.INTL(A2,B2,"1011111")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Counting specific days between dates

    Or this

    =ROUND(DATEDIF(A1,B1,"d")/7,0)


    A
    B
    C
    1
    6/17/2014
    3/16/2015
    39
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Counting specific days between dates

    Quote Originally Posted by AlKey View Post
    Or this

    =ROUND(DATEDIF(A1,B1,"d")/7,0)
    With some light testing that doesn't seem to be reliable.

    8/9/2011 - 1/22/2014
    11/20/2006 - 10/2/2014
    9/26/2000 - 1/8/2013

  6. #6
    Registered User
    Join Date
    05-16-2013
    Location
    Hertfordshire
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Counting specific days between dates

    Hello Bernie

    Many thanks for this. I guess there is a reason why the formula is complicated becuase it appears to be the only one that has worked for me.

    Kind regards
    floxxie

  7. #7
    Registered User
    Join Date
    05-16-2013
    Location
    Hertfordshire
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Counting specific days between dates

    Hi Tony

    I tried the formula but it did not seem to work for me. I am wondering if it is anything to do with the way we enter dates (UK dd/mm/yy vs US mm/dd/yy).....?
    And when you say weekday, I guess this is where I enter the day of the week I want counted? No quotation marks?

  8. #8
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,936

    Re: Counting specific days between dates

    Tony Valko's formula works for me.... though to make it easier to change from Tuesdays to any day:

    =INT((WEEKDAY(A2-(MATCH("Wednesday",{"Sunday";"Monday";"Tuesday";"Wednesday";"Thursday";"Friday";"Saturday"},FALSE)-1),2)+B2-A2)/7)
    Last edited by Bernie Deitrick; 05-13-2014 at 01:04 PM.

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Counting specific days between dates

    The date format doesn't matter. That's for display purposes only.

    The generalized formula is:

    =INT((WEEKDAY(Start_Date-n,2)+End_Date-Start_Date)/7)

    Where n = a weekday number from 1 to 7:

    1 = Monday
    2 = Tuesday
    3 = Wednesday
    4 = Thursday
    5 = Friday
    6 = Saturday
    7 = Sunday
    Last edited by Tony Valko; 05-13-2014 at 04:11 PM.

  10. #10
    Registered User
    Join Date
    05-16-2013
    Location
    Hertfordshire
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Counting specific days between dates

    Tony and Bernie,
    Thank you very much, much clearer now!

    Kind regards
    floxxie.

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Counting specific days between dates

    You're welcome. We appreciate the feedback!

+ 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. counting days between dates
    By rgps in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-16-2013, 12:25 PM
  2. Replies: 1
    Last Post: 11-01-2012, 03:41 PM
  3. Counting days between set dates
    By littlefoot in forum Excel General
    Replies: 2
    Last Post: 03-23-2012, 12:45 PM
  4. Replies: 4
    Last Post: 12-16-2011, 02:55 PM
  5. Counting Dates Within 60 Days
    By tkaye in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 12-05-2008, 06:03 PM

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