+ Reply to Thread
Results 1 to 14 of 14

Exclude blank cells from COUNTIFS formula

  1. #1
    Registered User
    Join Date
    07-03-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    5

    Exclude blank cells from COUNTIFS formula

    Hello experts

    I have a formula that counts the number of entries within a table based on two conditions

    Condition 1 - Column I = "No"
    Condition 2 - Column G = Less than 6 months

    I've got a formula as below which works except it's also counting blank cells where the data has yet to be entered.

    =SUM(IF(I27:I47="No",IF(G27:G47<=TODAY()-180,1,0)))

    Can anyone advise how I insert 'don't count blank cells' into this formula?

    Thanks in advance

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Exclude blank cells from COUNTIFS formula

    One way...

    Normally entered:

    =SUMPRODUCT(--(I27:I47="No"),--(G27:G47<>""),--(G27:G47<=TODAY()-180))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Exclude blank cells from COUNTIFS formula

    Try

    =COUNTIFS(I27:I47,"No",G27:G47,"<>",G27:G47,"<="&TODAY()-180)

  4. #4
    Valued Forum Contributor
    Join Date
    07-07-2014
    Location
    Washington DC
    MS-Off Ver
    2007
    Posts
    1,047

    Re: Exclude blank cells from COUNTIFS formula


  5. #5
    Registered User
    Join Date
    07-03-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    5

    Re: Exclude blank cells from COUNTIFS formula

    Thanks Tony and Bob

    Both work perfectly.

    Problem solved

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Exclude blank cells from COUNTIFS formula

    You're welcome. We appreciate the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Exclude blank cells from COUNTIFS formula

    If you're going to use countifs, you don't need to test for NOT blank.
    It will ignore blanks already.

    =COUNTIFS(I27:I47,"No",G27:G47,"<="&TODAY()-180)

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Exclude blank cells from COUNTIFS formula

    Quote Originally Posted by Jonmo1 View Post
    If you're going to use countifs, you don't need to test for NOT blank.
    It will ignore blanks already.

    =COUNTIFS(I27:I47,"No",G27:G47,"<="&TODAY()-180)
    Not sure if I agree. With A1 blank:

    =A1<=TODAY()

    will always return TRUE.

    Regards
    Click * below if this answer helped

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

  9. #9
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Exclude blank cells from COUNTIFS formula

    Quote Originally Posted by XOR LX View Post
    Not sure if I agree. With A1 blank:
    =A1<=TODAY()
    But that's not a countifs formula is it?

  10. #10
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Exclude blank cells from COUNTIFS formula

    Quote Originally Posted by Jonmo1 View Post
    But that's not a countifs formula is it?
    Apologies. You're correct.

    Regards

  11. #11
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Exclude blank cells from COUNTIFS formula

    No worries.

    I suppose we shouldn't say that countifs straight up ignores blanks.
    It does for Inclusive numerical comparisons (the value IS less than x)..
    But not for Exclusive (the value is NOT equal to)
    "<>Hello" or "<>10" Will count blanks.

  12. #12
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Exclude blank cells from COUNTIFS formula

    Quote Originally Posted by Jonmo1 View Post
    No worries.

    I suppose we shouldn't say that countifs straight up ignores blanks.
    It does for Inclusive numerical comparisons (the value IS less than x)..
    But not for Exclusive (the value is NOT equal to)
    "<>Hello" or "<>10" Will count blanks.
    Interesting stuff.

    I have to say that I find it a tad strange (not to mention practically difficult!) that there are all these seeming inconsistencies between functions when it comes to comparisons, particularly with regards to blanks.

    Cheers

  13. #13
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Exclude blank cells from COUNTIFS formula

    Quote Originally Posted by XOR LX View Post
    there are all these seeming inconsistencies between functions when it comes to comparisons, particularly with regards to blanks.
    Yep, and don't get me started on COUNTA vs COUNTBLANK with regards to formula blanks.
    COUNTA will consider ="" as NOT Blank
    COUNTBLANK will consider ="" as Blank.

    Ugh...

    I'll accept it either way, but both should be the same.

  14. #14
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Exclude blank cells from COUNTIFS formula

    Quote Originally Posted by Jonmo1 View Post
    Yep, and don't get me started on COUNTA vs COUNTBLANK with regards to formula blanks.
    COUNTA will consider ="" as NOT Blank
    COUNTBLANK will consider ="" as Blank.

    Ugh...
    LOL!! Agreed - a nightmare!

+ 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. [SOLVED] VBA code to exclude cells that are blank
    By msmithy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-20-2014, 05:54 AM
  2. Countifs should return blank results for blank row of cells
    By Groovicles in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-29-2013, 06:20 PM
  3. Getting Rank formula to exclude zero and blank cells
    By Catherine01 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-11-2013, 06:10 AM
  4. Exclude blank/FALSE cells in in Excel array IF formula output
    By sushix in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-08-2013, 11:42 AM
  5. Sum multiple cells, but exclude blank ones
    By GorillaBoze in forum Excel General
    Replies: 1
    Last Post: 12-23-2010, 01:37 PM

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