+ Reply to Thread
Results 1 to 6 of 6

Count number of specific dates within several years

  1. #1
    Registered User
    Join Date
    09-21-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    9

    Count number of specific dates within several years

    Hello

    Hope you guys can help me settle this problem.

    A = start date

    B = end date

    C = count the number of days that fall within 2010

    D = count the number of days that fall within 2011

    E = count the number of days that fall within 2012

    Please see attached data for further info.

    Also, I don't know if Excel will account for the fact that 2012 is a leap year.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Count number of specific dates within several years

    In c2

    =MAX(0,MIN(DATE(C$1,12,31),$B2)-MAX(DATE(C$1,1,1),$A2)+1)

    Copy down and across
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Count number of specific dates within several years

    hi thed85. it's good that you uploaded an excel file. but i'm having some problems with downloading some files here, so i'm going to make some assumptions.
    A2 contains Start Date
    B2 contains End Date
    C1 contains 2010, D1 2011, E1 2012

    so in C2,
    =MIN(DATE(C$1+1,1,1),$B2)-MAX(DATE(C$1,1,1),$A2)

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Count number of specific dates within several years

    Hi
    See solution attached.
    Good luck.
    Tony
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-21-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Count number of specific dates within several years

    Thanks Ace_XL. Your function also allows for leap year. Thats what i needed. Rep added!

  6. #6
    Registered User
    Join Date
    09-21-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Count number of specific dates within several years

    benishiryo:

    Thanks for the reply. Your function produces negative numbers. Can't see why?

    ARGK:

    Something seems to have gonw wrong. Your function only counts for a single year?

+ 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] Count Years Between Two Dates
    By sgwilliams in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-07-2011, 09:03 AM
  2. how to count dates and divide in years
    By DMR1712 in forum Excel General
    Replies: 3
    Last Post: 07-16-2010, 02:46 AM
  3. Dates, Number of Years
    By Soltisolti in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-16-2008, 06:49 AM
  4. [SOLVED] NUMBER OF YEARS BETWEEN TWO DATES - HOW TO GET
    By AJAY KUMAR DIXIT in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-16-2006, 05:25 AM
  5. count number of years 2003 in a range of dates
    By Stan Altshuller in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-03-2005, 03:06 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