+ Reply to Thread
Results 1 to 3 of 3

Need help with a date calculation

  1. #1
    Registered User
    Join Date
    02-08-2006
    Posts
    4

    Smile Need help with a date calculation

    Hi,

    HELP!

    Any help with this issue would be great. I'm trying to count the number of days for a given month in a range of cells that contain multiple months.

    Example:

    1/1/6
    3/1/6
    1/2/6
    1/5/6
    2/2/6
    2/7/6

    Answer: the number of days in January is 3, the # of days in March is 1, the number of days in February is 2.

    I've tried a variety of formulas, from counti, datedif, sumif, sumproduct, etc. and can't seem to get them to work.

    Any Ideas or help would be greatly appreciated.

    Thank you!

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

    If only the month is significant:
    =SUMPRODUCT(ISNUMBER(A1:A10)*(MONTH(A1:A10)=1))

    If the month and year are significant:
    =SUMPRODUCT(ISNUMBER(A1:A10)*(MONTH(A1:A10)=1)*(YEAR(A1:A10)=2006))


    Does that help?

    Regards,
    Ron

  3. #3
    Peo Sjoblom
    Guest

    Re: Need help with a date calculation

    =SUMPRODUCT(--(ISNUMBER(A2:A50)),--(MONTH(A2:A50)=1))

    for January, for the rest of the months you only need

    =SUMPRODUCT(--(MONTH(A2:A50)=2))

    (for February)

    the reason is that a blank cell will be interpreted as month number 1 thus
    the extra condition for Jan

    --
    Regards,

    Peo Sjoblom

    Portland, Oregon




    "jr100" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi,
    >
    > HELP!
    >
    > Any help with this issue would be great. I'm trying to count the
    > number of days for a given month in a range of cells that contain
    > multiple months.
    >
    > Example:
    >
    > 1/1/6
    > 3/1/6
    > 1/2/6
    > 1/5/6
    > 2/2/6
    > 2/7/6
    >
    > Answer: the number of days in January is 3, the # of days in March is
    > 1, the number of days in February is 2.
    >
    > I've tried a variety of formulas, from counti, datedif, sumif,
    > sumproduct, etc. and can't seem to get them to work.
    >
    > Any Ideas or help would be greatly appreciated.
    >
    > Thank you!
    >
    >
    > --
    > jr100
    > ------------------------------------------------------------------------
    > jr100's Profile:
    > http://www.excelforum.com/member.php...o&userid=31335
    > View this thread: http://www.excelforum.com/showthread...hreadid=510159
    >



+ 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