+ Reply to Thread
Results 1 to 7 of 7

Function for counting days between 2 dates for specific year

  1. #1
    Registered User
    Join Date
    08-24-2016
    Location
    Philadelphia, US
    MS-Off Ver
    2013
    Posts
    6

    Function for counting days between 2 dates for specific year

    Hi,

    I know the workday function can count days between 2 dates. But is there a way to count days only in a specific year.

    Example:
    6/10/16 - 3/21/17 How can I use a function to count only the number of days in 2016.

    Thank you for any help you can provide.

    Best,

    Eric

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,031

    Re: Function for counting days between 2 dates for specific year

    Assuming the first (start) date is in A1 (the second, end date, seems to be irrelevant) try:

    =DATE(YEAR(A1),12,31)-A1
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    08-24-2016
    Location
    Philadelphia, US
    MS-Off Ver
    2013
    Posts
    6

    Re: Function for counting days between 2 dates for specific year

    Hi Glenn thanks for the response.

    That is useful if all the rows in my column have the 2nd date in 2017. But some end in 2016 like 6/10/16 - 9/15/16. The function above would inflate the days in 2016. That's what I'm trying to solve, so the 2nd date is relevant. I didn't originally explain that well. I'm trying to drag this function down for a lot of rows.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,031

    Re: Function for counting days between 2 dates for specific year

    Silly me.

    Strart A1, End B1

    =MIN(DATE(YEAR(A1),12,31)-A1,B1-A1)

  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: Function for counting days between 2 dates for specific year

    Maybe this...

    Data Range
    A
    B
    C
    1
    Start
    End
    Total
    2
    6/10/2016
    3/21/2017
    205
    3
    1/1/2016
    1/2/2016
    2
    4
    12/15/2015
    1/10/2016
    10
    5
    12/20/2015
    1/1/2017
    366


    This formula entered in C2 and copied down:

    =SUMPRODUCT(--(YEAR(ROW(INDIRECT(A2&":"&B2)))=2016))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Registered User
    Join Date
    08-24-2016
    Location
    Philadelphia, US
    MS-Off Ver
    2013
    Posts
    6

    Re: Function for counting days between 2 dates for specific year

    Thank you both that did it.

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

    Re: Function for counting days between 2 dates for specific year

    You're welcome. Thanks for 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. [SOLVED] Function for counting days between 2 dates for specific year
    By erthmill in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-09-2016, 12:58 PM
  2. [SOLVED] Formula for counting rain days of the year, month, and or week
    By dedark05 in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 05-24-2016, 01:27 AM
  3. [SOLVED] Counting specific days between dates
    By floxxie in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 05-14-2014, 08:44 AM
  4. [SOLVED] Count days for specific year falling within in multi-year date range
    By jslo2013 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-04-2012, 05:58 PM
  5. Convert a multiple year list of 365 days/year into an equivalent of 360 days/year
    By lobotomy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-24-2012, 05:39 PM
  6. counting function with criteria + for specific week in the year
    By polacoloco in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-20-2010, 10:27 AM
  7. Replies: 8
    Last Post: 03-29-2010, 09:20 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