+ Reply to Thread
Results 1 to 13 of 13

COUNTIF Using two Criteria

  1. #1
    Registered User
    Join Date
    04-28-2008
    Posts
    6

    COUNTIF Using two Criteria

    Hi

    I've had a search around the site without much luck.
    I'm trying to count up a number of "won" estimates during a certain date period.
    I have attached a simplified example of my data sheet.
    Each row shows an amount of data entered for each contract, including the date and whether it was won or lost.
    I want to count up the number of won estimates by cross referencing against the date so i can see how many were won during a certain month.

    Cheers
    Mark
    Attached Files Attached Files

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: COUNTIF Using two Criteria

    Hi

    One way, is this formula.

    Please Login or Register  to view this content.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: COUNTIF Using two Criteria

    Try:

    =SUMPRODUCT(--(MONTH($C$7:$C$16=1)),--($F$7:$F$16="won"))

  4. #4
    Registered User
    Join Date
    04-28-2008
    Posts
    6

    Re: COUNTIF Using two Criteria

    Thanks for the quick response.

    While this solution works on my simplified sheet, when i try it on the more complex sheet i keep getting a #VALUE! error.
    The only difference i can see on the other sheet is that the dates and won lost column are in data lists.
    Would this cause this problem?

    Mark

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: COUNTIF Using two Criteria

    Alternative

    =COUNTIFS(C7:C16,">=12/1/1",C7:C16,"<12/2/1",F7:F16,"won")

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: COUNTIF Using two Criteria

    I don't understand the reason for this...

    Would you like to upload a small sample worksheet, that is the same with your original?

  7. #7
    Registered User
    Join Date
    04-28-2008
    Posts
    6

    Re: COUNTIF Using two Criteria

    Thanks Cutter, i managed to get it to work that way.

    The problem i have is i'm no expert and i've been asked to mod a sheet that someone else set up to do a few extra things.
    I'm finding more and more problems as i go along.

    Can i ask is it possible to just sum/count, visible cells on a filterd list?

    This is my sheet attached with the sensitive data removed.
    Its basically a master sheet, with tabs that reference it to show monthly figures.

    The cells highlighted in blue on Nov 2011 tab are the ones i am struggling with.

    L9/10/11 just need to add the monthly totals and i cant work out how to get the date reference into these.
    G15 needs to count column Q but ignore pending/estimating and void.
    G16 needs to count as G15 but only return the number won.

    I understand this is a big ask and is probably a mess from the beginning but any help is much appreciated.

    Thanks

    Mark
    Attached Files Attached Files

  8. #8
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: COUNTIF Using two Criteria

    Quote Originally Posted by cleggy621 View Post
    Can i ask is it possible to just sum/count, visible cells on a filterd list?
    Instead of SUM formula write this: =SUBTOTAL(109,K22:K340) (same for other cells)

  9. #9
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: COUNTIF Using two Criteria

    Here is a link to the various forms of the SUBTOTAL() function.

  10. #10
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: COUNTIF Using two Criteria

    Hi Mark,

    In L9,

    Please Login or Register  to view this content.
    Copy to L10 & L11

    G15,

    Please Login or Register  to view this content.
    G16,

    Please Login or Register  to view this content.
    better to use dynamic range, instead of hard coding the range
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  11. #11
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: COUNTIF Using two Criteria

    For that first one you could possibly shorten by using this

    =SUMPRODUCT(SUBTOTAL(9,OFFSET(N$22,ROW(N$22:Q$1000)-ROW(N$22),))*(Q$22:Q$1000=K9))
    Audere est facere

  12. #12
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: COUNTIF Using two Criteria

    Yes DLL

  13. #13
    Registered User
    Join Date
    04-28-2008
    Posts
    6

    Re: COUNTIF Using two Criteria

    Thanks for all your help!
    Done the job.
    Much Appreciated.

    However, I'm getting circular references in cells G15/16, L9/10/11 is this something to worry about or not?

    Cheers

    Mark

+ 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