+ Reply to Thread
Results 1 to 3 of 3

COUNTIFS - Multiple Conditions with Cell Reference

  1. #1
    Registered User
    Join Date
    10-02-2020
    Location
    Toronto, Canada
    MS-Off Ver
    Office 365
    Posts
    3

    COUNTIFS - Multiple Conditions with Cell Reference

    I'm trying to count up the data points that meet a series of conditions (about 7 or 8 conditions in total). All of these data points are in my "All Data (Cleaned Up)" worksheet and I am using a COUNTIFS formula. As of now, this formula IS producing the expected result:

    =COUNTIFS('All Data (Cleaned Up)'!$E$2:$E$1000000,">="&A12,'All Data (Cleaned Up)'!$E$2:$E$1000000,"<="&B12,'All Data (Cleaned Up)'!$L$2:$L$1000000,"=FALSE",'All Data (Cleaned Up)'!$S$2:$S$1000000,">""",'All Data (Cleaned Up)'!$AA$2:$AA$1000000,">""178",'All Data (Cleaned Up)'!$AB$2:$AB$1000000,"Dollars",'All Data (Cleaned Up)'!$B$2:$B$1000000,">="&$B$1,'All Data (Cleaned Up)'!$B$2:$B$1000000,"<="&$B$2,'All Data (Cleaned Up)'!$F$2:$F$1000000,"=YES")

    I'd like to make a change to one of the conditions -- specifically the condition that's based on column AA. Currently, the formula looks for values in that column that are greater than 178. Notice that there is no & between the ">" and the "178", but the formula works. When I put an & in between those two strings, the formula actually stops working (it computes to 0 - as if there are no matches).

    Anyways, I'd like to make two changes to the formula. First, I'd like to change the operator from ">" to ">=". I'd also like to replace the reference to "178" with a cell reference (so that the number I'm using for the >= comparison can be dynamic). The cell reference I'm trying to use for the dynamic input is cell B4 in the current worksheet.

    I have tried the following formula, but it does not work (it computes to 0 - as if there are no matches).

    =COUNTIFS('All Data (Cleaned Up)'!$E$2:$E$1000000,">="&A12,'All Data (Cleaned Up)'!$E$2:$E$1000000,"<="&B12,'All Data (Cleaned Up)'!$L$2:$L$1000000,"=FALSE",'All Data (Cleaned Up)'!$S$2:$S$1000000,">""",'All Data (Cleaned Up)'!$AA$2:$AA$1000000,">="&B4,'All Data (Cleaned Up)'!$AB$2:$AB$1000000,"Dollars",'All Data (Cleaned Up)'!$B$2:$B$1000000,">="&$B$1,'All Data (Cleaned Up)'!$B$2:$B$1000000,"<="&$B$2,'All Data (Cleaned Up)'!$F$2:$F$1000000,"=YES")

    Any suggestions of how I can accomplish what I'm trying would be welcome! Thanks!

  2. #2
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: COUNTIFS - Multiple Conditions with Cell Reference

    Quote Originally Posted by Epilogue View Post
    Notice that there is no & between the ">" and the "178", but the formula works.
    The formula is merely syntactically valid. The ">""178" is interpreted as greater than the TEXT "178, that is, a double quote character followed by 178. The two sequential double quotes are treated as a single literal double quote character in the text constant.

    Does 'All Data (Cleaned Up)'!$AA$2:$AA$1000000 contain text comprised of decimal numerals? Note that if B1 contained ="177", producing TEXT "177", =COUNT(B1,">""178") returns 1. Why? Because Excel's collation sequence considers the double quote character less than the numeral 1. Change the formula to =COUNTIF(B1,">"&"178"), and the changed formula returns 0.

    What does the formula =SUMPRODUCT(ISNUMBER('All Data (Cleaned Up)'!$AA$2:$AA$1000000)+('All Data (Cleaned Up)'!$AA$2:$AA$1000000>"178")) return? If it returns 0, then there are no numeric values in that range, AND there are no text values greater than "178".

    Your 2nd formula should work, but you need to check your data. See the formula in the immediately preceding paragraph.

  3. #3
    Registered User
    Join Date
    10-02-2020
    Location
    Toronto, Canada
    MS-Off Ver
    Office 365
    Posts
    3
    Quote Originally Posted by hrlngrv View Post
    The formula is merely syntactically valid. The ">""178" is interpreted as greater than the TEXT "178, that is, a double quote character followed by 178. The two sequential double quotes are treated as a single literal double quote character in the text constant.

    Does 'All Data (Cleaned Up)'!$AA$2:$AA$1000000 contain text comprised of decimal numerals? Note that if B1 contained ="177", producing TEXT "177", =COUNT(B1,">""178") returns 1. Why? Because Excel's collation sequence considers the double quote character less than the numeral 1. Change the formula to =COUNTIF(B1,">"&"178"), and the changed formula returns 0.

    What does the formula =SUMPRODUCT(ISNUMBER('All Data (Cleaned Up)'!$AA$2:$AA$1000000)+('All Data (Cleaned Up)'!$AA$2:$AA$1000000>"178")) return? If it returns 0, then there are no numeric values in that range, AND there are no text values greater than "178".

    Your 2nd formula should work, but you need to check your data. See the formula in the immediately preceding paragraph.
    The second I read your response, I knew you had identified the issue. My numbers were parsed out of a string. I converted them to numbers, and it all works perfectly now.


    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. COUNTIFS formula with multiple conditions
    By flyaround67 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-22-2020, 02:41 PM
  2. [SOLVED] COUNTIFS Issue w/multiple date conditions
    By brulottej in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-28-2016, 07:39 PM
  3. CountIfs With Multiple Conditions
    By 5150 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-13-2015, 11:16 AM
  4. COUNTIFS multiple conditions
    By akkerstad in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 11-04-2014, 03:38 PM
  5. Multiple conditions plus reference to adjacent cell in Excel 2003
    By southend in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-03-2013, 07:10 AM
  6. [SOLVED] CountIfs With Multiple Conditions
    By NotQuiteThere in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-18-2012, 09:35 PM
  7. Countifs for multiple conditions
    By batjl9 in forum Excel General
    Replies: 4
    Last Post: 03-25-2011, 09:07 PM

Tags for this Thread

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