+ Reply to Thread
Results 1 to 10 of 10

COUNTIFS function not recognizing criteria for "if date in P is greater than date in D"

  1. #1
    Registered User
    Join Date
    01-31-2018
    Location
    Bathurst, NB
    MS-Off Ver
    2010
    Posts
    37

    COUNTIFS function not recognizing criteria for "if date in P is greater than date in D"

    Hello,

    I'm using the countifs function to compile some entries. I was using the string: =COUNTIFS(E:E,"Word*",P:P,"") in order to return the number of rows containing Initial* in E and no dates in P.

    What I actually need is the same for the partial match, but the second criteria would need to be if cell in P is either blank or if the date is smaller than date in column D.

    I tried: =COUNTIFS(E:E,"Word*",P:P,"<D:D") but it does not work.

    I managed to get a count of the all the rows in which the date in P is smaller than the date in D with SUMPRODUCT, with: =SUMPRODUCT(--(D:D>P:P))

    However, I need to have a count of the rows with "(partial Word match in E) AND (P=blank OR P<D)"

    What I don't understand is how come I get the same result with =COUNTIFS(E:E,"Word*",P:P,"<D:D") than what I get with =COUNTIFS(E:E,"Word*",P:P,"")

    Thanks again for all the great help.

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: COUNTIFS function not recognizing criteria for "if date in P is greater than date in D

    you're close, just change it to this...
    =COUNTIFS(E:E,"Word*",P:P,"<"&D:D)
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: COUNTIFS function not recognizing criteria for "if date in P is greater than date in D

    =COUNTIFS(E:E,"Word*",P:P,"<"&D:D)

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

    Re: COUNTIFS function not recognizing criteria for "if date in P is greater than date in D

    countifs is expecting the criteria to be a single value, not an array.

    You could put in a helper column (they're not a bad thing)
    Say in Q2 and filled down
    =P2<D2

    Then use
    =COUNTIFS(E:E,"Word*",Q:Q,TRUE)

  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: COUNTIFS function not recognizing criteria for "if date in P is greater than date in D

    Try this:

    =SUMPRODUCT((E:E="Word*")*((P:P="")+(P:P<D:D)))

    Just note that you will want to change the ranges to a smaller range such as E$2:E$1000 or whatever works for you.

    This is untested.


    Edit: Just tested it. This will not work
    Last edited by 63falcondude; 02-15-2018 at 07:22 PM.

  6. #6
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: COUNTIFS function not recognizing criteria for "if date in P is greater than date in D

    countifs is expecting the criteria to be a single value, not an array.
    Jonmo1
    here - yes,
    but not always
    =SUM(COUNTIFS(A1:A12,B1:B12)) ,CSE
    Attached Files Attached Files

  7. #7
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: COUNTIFS function not recognizing criteria for "if date in P is greater than date in D

    tim, the problem though is that Jonmo's correct, neither of ours works in every scenario I've tested. The best result would be for the helper column as he describes then the count for true seems easiest. It counts every cell with "word*" as long as there is some number in P and doesn't matter what is in D, it can even be blank.

  8. #8
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: COUNTIFS function not recognizing criteria for "if date in P is greater than date in D

    I just got around to testing this. This formula seems to work without any helper columns:

    =SUMPRODUCT((ISNUMBER(SEARCH("Word",E:E)))*(P:P<D:D))

    Just change the whole column references to something smaller.

  9. #9
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,914

    Re: COUNTIFS function not recognizing criteria for "if date in P is greater than date in D

    Or try:

    =SUMPRODUCT(ISNUMBER(SEARCH("Word",E1:E10))*((P1:P10="")+(P1:P10<D1:D10)>0))

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

    Re: COUNTIFS function not recognizing criteria for "if date in P is greater than date in D

    Quote Originally Posted by tim201110 View Post
    =SUM(COUNTIFS(A1:A12,B1:B12)) ,CSE
    COUNTIFS is still really only seeing 1 cell at a time, B1 then B2 then B3
    It's basically doing
    COUNTIFS(A1:A12,B1)+COUNTIFS(A1:A12,B2)+COUNTIFS(A1:A12,B3)+etc.

+ 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. Coding Help - CDate & "Greater Than" Date
    By imacna11 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-04-2015, 04:01 PM
  2. Replies: 4
    Last Post: 09-20-2014, 07:10 AM
  3. [SOLVED] Macro to highlight date cells based on criteria linked to "today"'s date
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 04-08-2014, 09:18 AM
  4. [SOLVED] Macro to highlight date cells based on criteria linked to "today"'s date
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-04-2013, 10:59 AM
  5. Using DMIN to evaluate "less than" or "greater than" a specific date
    By williams485 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-01-2012, 12:45 PM
  6. Replies: 1
    Last Post: 09-15-2010, 01:55 AM
  7. Replies: 2
    Last Post: 03-11-2006, 04:50 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