Consulting

Results 1 to 19 of 19

Thread: Countif multiple criteria

  1. #1
    VBAX Mentor Sir Babydum GBE's Avatar
    Joined
    Mar 2005
    Location
    Cardiff, UK
    Posts
    499
    Location

    Countif multiple criteria

    Say column A contains a list of Dates and Times (so the serial number will have something after the decimal)
    Column B a list of products

    How do I do a countif that works out how many of a given product were sold on a given day?

    Thanks
    Have a profound problem? Need a ridiculous solution? Post a question in Babydum's forum

  2. #2
    BD,
    Are you talking formula or code?
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  3. #3
    VBAX Mentor Sir Babydum GBE's Avatar
    Joined
    Mar 2005
    Location
    Cardiff, UK
    Posts
    499
    Location
    Quote Originally Posted by YellowLabPro
    BD,
    Are you talking formula or code?
    Formula please. I like formulae
    Have a profound problem? Need a ridiculous solution? Post a question in Babydum's forum

  4. #4
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    Formula:
    =SUMPRODUCT(--(INT($A$1:$A$100)=INT(DATE(2007,9,21))))
    for example.
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by rory
    Formula:
    =SUMPRODUCT(--(INT($A$1:$A$100)=INT(DATE(2007,9,21))))
    for example.
    The second INT is a tad redundant.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    But what's a tad between friends?
    Regards,
    Rory

    Microsoft MVP - Excel

  7. #7
    VBAX Mentor Sir Babydum GBE's Avatar
    Joined
    Mar 2005
    Location
    Cardiff, UK
    Posts
    499
    Location
    Thanks! And where do I put the product match into the formula?
    Have a profound problem? Need a ridiculous solution? Post a question in Babydum's forum

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    =SUMPRODUCT(--(INT($A$1:$A$100)=DATE(2007,9,21)),--(B1:B100="product"))
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  9. #9
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by rory
    But what's a tad between friends?
    A tad too much.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  10. #10
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    =SUMPRODUCT((INT($A$1:$A$100)=DATE(2007,9,21))*($B$1:$B$100="Product name"))
    You can replace the date and product name with cell references containing the values you want.
    Regards,
    Rory

    Microsoft MVP - Excel

  11. #11
    VBAX Mentor Sir Babydum GBE's Avatar
    Joined
    Mar 2005
    Location
    Cardiff, UK
    Posts
    499
    Location
    Thanks Gentlemen.
    Have a profound problem? Need a ridiculous solution? Post a question in Babydum's forum

  12. #12
    Same question just in another way?
    If i have a list of data and a template with formulas in to pull info through...

    I would like to have a countif and sumif axample if i can search between two seperate date???

  13. #13
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    =SUMPRODUCT(--(rng_date>=--"2007-01-01"),--(rng_date)<="2007-02-01"))

    to count them

    =SUMPRODUCT(--(rng_date>=--"2007-01-01"),--(rng_date)<="2007-02-01"),rng_amount)

    to sum them
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  14. #14
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    If your start and end date criteria are in C1 and d1, then:
    Count: =SUMPRODUCT(($A$1:$A$100>=$C$1)*($A$1:$A$100<=$D$1))
    Sum (of F): =SUMPRODUCT(($A$1:$A$100>=$C$1)*($A$1:$A$100<=$D$1)*$F$1:$F$100)
    Regards,
    Rory

    Microsoft MVP - Excel

  15. #15
    Quote Originally Posted by xld
    A tad too much.
    Is this 'Tid for Tad' ?
    2+2=9 ... (My Arithmetic Is Mental)

  16. #16
    VBAX Tutor
    Joined
    Aug 2007
    Posts
    273
    Location
    what dose the "--" do in this function? i have never seen functions using this

  17. #17
    The double negatives:
    To force Excel to coerce the booleans appropriately, two negative signs are added to the formula. Excel negates the result, then negates it again which is enough to make it work.

    http://www.dailydoseofexcel.com/arch...rray-formulas/
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  18. #18
    VBAX Tutor
    Joined
    Aug 2007
    Posts
    273
    Location
    thanks, thats good to know

  19. #19
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by figment
    what dose the "--" do in this function? i have never seen functions using this
    See http://www.xldynamic.com/source/xld.SUMPRODUCT.html for a detailed explanation.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •