+ Reply to Thread
Results 1 to 6 of 6

Countif between 2 numbers and if another column is blank

  1. #1
    Forum Contributor
    Join Date
    04-28-2004
    Location
    Norwich, England
    MS-Off Ver
    2010
    Posts
    119

    Countif between 2 numbers and if another column is blank

    Hi All

    I am trying to do some sort of COUNTIF/SUMPRODUCT but getting more and more confused!

    I keep almost getting there with SUMPRODUCT but not quite

    I am looking to:

    In cell CZ1 - Count instances in column BK >14 and only if there is nothing in the corresponding cell in BZ

    In cell DB1 - Count instances in column BK 5 -14 inclusive and only if there is nothing in the corresponding cell in BZ

    In cell DD1 - Count instances in column BK 0-4 inclusive (but not less than zero) and only if there is nothing in the corresponding cell in BZ


    (Attached is a sanitised spreadsheet)

    Very many thanks in advance

    Rae
    Attached Files Attached Files
    Last edited by raehippychick; 07-08-2010 at 07:18 AM.

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

    Re: Countif between 2 numbers and if another column is blank

    Perhaps you want:

    =SUMPRODUCT(--($BK$2:$BK$64>14),--($BZ$2:$BZ$64=""))

    =SUMPRODUCT(--($BK$2:$BK$64>=5),--($BK$2:$BK$64<=14),--($BZ$2:$BZ$64=""))

    =SUMPRODUCT(--($BK$2:$BK$64>=0),--($BK$2:$BK$64<5),--($BZ$2:$BZ$64=""))

    If working exclusively in XL2007(+) environment you can/should use COUNTIFS in pref. to SUMPRODUCT in this instance.

  3. #3
    Registered User
    Join Date
    07-01-2010
    Location
    High Wycombe
    MS-Off Ver
    Excel 2003
    Posts
    95

    Re: Countif between 2 numbers and if another column is blank

    Have you tried using IF with it?

    EG:
    First
    CZ1 =IF(BZ="",COUNTIF(BK>14),"")

    Second
    DB1 =IF(BZ="",(COUNTIF(BK<14)-(COUNTIF(BK<5),"")

    Third
    DD1 =IF(BZ="",COUNTIF(BK<4),"")

  4. #4
    Forum Contributor
    Join Date
    04-28-2004
    Location
    Norwich, England
    MS-Off Ver
    2010
    Posts
    119

    Re: Countif between 2 numbers and if another column is blank

    Hi DonkeyOte

    Huge thanks for those - the first 2 work perfectly, but the 3rd one gives me 4969 when there are only 49 instances - that's pretty much what happened when I tried (before I even got anywhere near being able to include the BZ column to it)

    If I remove the = and just have >0 it works fine unless I have a zero in the list and there will always be zeores to count

    I've tried it with just the >0 and adding another bit for =0 but failed dismally

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

    Re: Countif between 2 numbers and if another column is blank

    So presumably you wish to exclude blanks in the numerical range (these will be interpreted as 0)

    =SUMPRODUCT(--ISNUMBER($BK$2:$BK$64),--($BK$2:$BK$64>=0),--($BK$2:$BK$64<5),--($BZ$2:$BZ$64=""))

    Of course if there are no other numerical values outside of the 5+ range (to be excluded from this calculation) you could perhaps just test the count of numbers in BK and subtract from that figure the other two results ?

  6. #6
    Forum Contributor
    Join Date
    04-28-2004
    Location
    Norwich, England
    MS-Off Ver
    2010
    Posts
    119

    Re: Countif between 2 numbers and if another column is blank

    Brilliant - that works perfectly

    Thank you so much - and apologies for being particularly dim... should have twigged that blanks would be counted as zero

    Rae

+ 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