+ Reply to Thread
Results 1 to 9 of 9

Count instances of a value within a date-range

  1. #1
    Registered User
    Join Date
    09-30-2011
    Location
    Lithuania
    MS-Off Ver
    Excel 2010
    Posts
    81

    Count instances of a value within a date-range

    I'm trying to compose a formula which will count number of instances of a value within a given date range. My first attempt embarrassingly wrong:

    Please Login or Register  to view this content.
    Can anyone help me see how best to compose a formula that counts the number of times "Orange" appears in column G if the date in column A is between the parameters set in cells 500 and 501? I'm using "10/1/2011" in cell 500 and "12/30/2011" in cell 501.

    Many thanks, in advance, to anyone who can assist!

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Count instances of a value within a date-range

    If you're using XL2010 as implied you can use COUNTIFS

    Please Login or Register  to view this content.
    modify delimiter per your own regional requirements (ie ; to ,)

  3. #3
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Count instances of a value within a date-range

    Hi Nate,

    See the attached file and let me know if this solves your purpose.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    Last edited by DonkeyOte; 01-06-2012 at 04:52 PM. Reason: Incorrect Attachment removed.
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Count instances of a value within a date-range

    dilipandey, either wrong thread or wrong attachment.

  5. #5
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Count instances of a value within a date-range

    You are right DonkeyOte..!! Thanks for the catch.

    Hi Nate, See the correct file uploaded here.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    09-30-2011
    Location
    Lithuania
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: Count instances of a value within a date-range

    DonkeyOte: Thank you! I did have to modify the semi-colon to a comma, but I'm still receiving an error. Would I have to modify the command to "SEARCH", if I wanted to find text that appears among other text in the cell?

    I think I'm having difficulty because one of the values ends with a quotation mark, like Orange "Yum-Soda". So I want to use "Orange" as the value to count, to simplify the formula, and to avoid problems with the quotation marks.

    dilipandey: Much appreciated! When I plug that formula into my sheet, I'm receiving a "0" for the count. I think it has to do with the above explained issue.

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Count instances of a value within a date-range

    COUNTIFS accepts Wildcards.

    Please Login or Register  to view this content.
    earlier error because I used 40000 and 4000 and in COUNTIFS each dimension has to be identical in size.


    @Dilipandey:

    {=SUM(--($A$1:$A$17>=$B$3)*($A$1:$A$17<=$B$4)*($G$1:$G$17="Orange"))}
    There is no need for the double unary operator in the above. The multiplication of the arrays will coerce the boolean array by default.
    Last edited by DonkeyOte; 01-06-2012 at 07:30 PM. Reason: typo

  8. #8
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Count instances of a value within a date-range

    Hi Nate,

    I believe you have missed the { sign in the formula which can be included if you enter the formula with Ctrl+Shift+Enter key combination.
    Let me know if this helps.

    @ DonkeyOte, I have checked the formula and it is working fine, not able to get you. Please explain a little further. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  9. #9
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Count instances of a value within a date-range

    Quote Originally Posted by dilipandey
    @ DonkeyOte, I have checked the formula and it is working fine, not able to get you. Please explain a little further. Thanks.
    I did not say it would not work merely that the double unary was superfluous:

    Please Login or Register  to view this content.
    and

    Please Login or Register  to view this content.
    will both generate the exact same result, i.e 1

    Multiplication will by default coerce both elements; the additional double unary operation is therefore an unnecessary overhead (albeit virtually non-existent)

+ 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