+ Reply to Thread
Results 1 to 4 of 4

COUNTIF greater than, less than across multiple ranges

  1. #1
    Registered User
    Join Date
    04-24-2010
    Location
    Tennessee, USA
    MS-Off Ver
    Excel 2007
    Posts
    9

    COUNTIF greater than, less than across multiple ranges

    I would like to do various reports from one worksheet (remaining in the same workbook). I need to count cells AF2:AF289 on another sheet that are >1.5 but <=3.0. That needs to be added to a count of cells BD2:BD289 on that same sheet that are >1.5 but <-3.0 Here is a copy of the formula that is not working. It may relay more clearly what I am trying to do.
    =COUNTIF('TN''s Survey Data by Region'!AF2:AF290,">1.5")-COUNTIF('TN''s Survey Data by Region'!AF2:AF290,"<=3.0")+COUNTIF('TN''s Survey Data by Region'!BD2:BD290,">1.5")-COUNTIF('TN''s Survey Data by Region'!BD2:BD290,"<=3.0")

    Obviously this is NOT working. I have attempted to use SUMIF to sum the two greater than / less than countif arrays - FAIL. I tried to do dFunctions - FAIL. SUMPRODUCT - fail. Arrays, database functions.... I'm spent. I have read Excel "help" sites until my eyes are ready to bleed and now I'm thinking I've gotten tunnel vision and cannot see the obvious. Any assistance would be greatly, greatly appreciated. I'm not a newbe to Excel (since 97) but this has definately brought that old novice feeling back again.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699

    Re: COUNTIF greater than, less than across multiple ranges

    To get a correct "between" count you need the second (and fourth) COUNTIF(s) to be reversed like this

    =COUNTIF('TN''s Survey Data by Region'!AF2:AF290,">1.5")-COUNTIF('TN''s Survey Data by Region'!AF2:AF290,">3.0")+COUNTIF('TN''s Survey Data by Region'!BD2:BD290,">1.5")-COUNTIF('TN''s Survey Data by Region'!BD2:BD290,">3.0")

  3. #3
    Registered User
    Join Date
    04-24-2010
    Location
    Tennessee, USA
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: COUNTIF greater than, less than across multiple ranges

    FANTASTIC! It worked! I would like to know - if possible - how removing the "=" from the end of each half of the formula remedied the problem. I have 5 different totals I pull from these ranges. (less than 1.5, equal to 1.5, greater than 1.5 but not more than 3.0, more than 3.0 but not more than 5.0, and finally more than 5.0). Obviously I can get the first two and the last one. The third and fourth figures are the two that have been the "root of all evil." I found plenty of self-help sites (including Microsoft) that described the "COUNTIF greater than / less than" formula but they did not go into combining COUNTIF functions (which is when the formula would fail.) Some sites stated that COUNTIF functions containing multiple ranges could not be combined. Any information to help me learn from this formula would be greatly appreciated. YOU ROCK!

  4. #4
    Registered User
    Join Date
    04-24-2010
    Location
    Tennessee, USA
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: COUNTIF greater than, less than across multiple ranges

    OMG! If you don't mind, I think I have been struck by an active brain cell! I was using a formula that I found on numerous (other) sites. >x - <=x I couldn't figure out what the "-" was for between the first and last half of the formula. It didn't make since the way they were posting it, but hey, who was I to question them? DUH! "-" outside of quotes and within a formula is subtraction every day of the week! The formula solution you provided counts all cells that are more than 3.0 and SUBTRACTS all the cells over 5.0. This leaves the cells greater than 3.0 but not more than 5.0. CLARITY - well, for me anyway. Love those "Ah-hah moments."

+ 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