+ Reply to Thread
Results 1 to 19 of 19

COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

  1. #1
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Question COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    C5 - C52 have either the following values: Pass, ADD, DNE, IC, CORR, or IE.

    In that specific range, I wanted to count how many times it IS NOT a Pass.

    This is the following formula I currently have: =COUNTIF(C5:C52,"<> Pass")

    However, it doesn't work because the value that I get is 48, which is the total range.
    Am I doing something wrong?

    As a side note, C5, C6, C7, etc. all are merged cells (C5 is merged with D5, C6 is merged with D6, etc.)

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    Try it without the space between > and P

    Hope this helps.

    Pete

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    This will work: =COUNTIF(C5:C52,"<>Pass")
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    Yes, both of you are right. It did work.

    Now I need to do just one more count if but it needs to meet 2 criteria.

    1. A row is USUALLY 1 widget. If the next row has the same widget, then it can't count it again.
    2. In a range of cells (2 columns), if its blank on both of the rows, then it can't count the widget.

    How do I put in the COUNTIF Formula

    =COUNTIF(the widget row, the widget above it can't be the same widget name AND if they aren't the same, count them only if the corresponding row in columns L & M ARE NOT BLANK)

    Is it: COUNTIF(B5:B52, L5:M52<>" "" B5<>B6 (note: I forgot what was the array symbol))?

  5. #5
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    Try

    =SUMPRODUCT((B5:B52<>B6:B53)*(L5:L52<>"")*(M5:M52<>""))
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  6. #6
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    Ace... almost there. I tested it. I do get the correct total that I'm looking for, but for the wrong reason.

    Lets say Widget 26 is in row 26. Since L26 and M26 are populated, it counts it.
    If EITHER L26 or M26 are NOT POPULATED, then it wont count it.

    What I need the formula to say is that it will not count Widget 26 ONLY WHEN L26 AND 256 are not populated.
    If either L26 OR M56 are populated, then its ok... it CAN BE counted.

  7. #7
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    In simpler terms


    Column B Column L Column M
    ---------- --------- ----------
    Widget 24 ABC ZZZ - Count the cell (L24 & L25 are populated)
    Widget 25 345 - Count the cell (L25 is populated)
    Widget 26 ??! - Count the cell (M26 is populated)
    Widget 27 - DON'T COUNT the cell (L27 & M27 are not populated)
    Widget 28 abc - Count the cell (L28 is populated)
    Widget 28 - Already counted, so no need to count it
    Widget 28 abc - Already counted, so don't count it again.

  8. #8
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    Hey, it removed my spaces! I hope you guys can understand what I was trying to say.

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    Why don't you just attach a workbook - then we can see what you are trying to describe.

    Pete

  10. #10
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    Here you go.
    Check it out.
    Attached Files Attached Files

  11. #11
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    This "array formula" will give you a count of different widgets where at least one of col B and col C is populated

    =SUM(IF(FREQUENCY(IF(A2:A30<>"",IF(B2:B30&C2:C30<>"",MATCH(A2:A30,A2:A30,0))),ROW(A2:A30)-ROW(A2)+1),1))

    confirmed with CTRL+SHIFT+ENTER
    Audere est facere

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

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    OK, so what exactly do you want to count?

    It sounds like you want to count the unique entries in column A that have at least 1 "x" in either column B or column C.

    Is that correct?

    EDIT: Looks like DLL and I have the same interpretation.
    Last edited by Tony Valko; 07-20-2013 at 11:47 AM.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  13. #13
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    SOLVED!

    daddylonglegs... At first it didn't work, it gave me the #value error but I forgot to array it.

    Why does array'ing it make it work?

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

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    Quote Originally Posted by JPWRana View Post
    Why does array'ing it make it work?
    See this...

    http://www.cpearson.com/Excel/ArrayFormulas.aspx

  15. #15
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    Interesting... thanks Tony.

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

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    You're welcome!

  17. #17
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    Quote Originally Posted by Pete_UK View Post
    Try it without the space between > and P

    Hope this helps.

    Pete
    As I am using it now, I forgot (my fault) to add one scenario. If the cell is blank, don't count it at all.
    This is concerning the first function I had trouble with... =COUNTIF(C5:C52,"<>Pass")

  18. #18
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    Try using COUNTIFS to count cells that are neither "Pass" nor blank....like this

    =COUNTIFS(C5:C52,"<>Pass",C5:C52,"<>")

  19. #19
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: COUNTIF Formula with DOES NOT EQUAL TO operator doesn't work

    Thanks. That did the trick.
    I never heard of COUNTIFS before.

+ 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. Formula Doesn't Work
    By Gene Venzke in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 03-10-2013, 08:54 PM
  2. Not Equal To Operator
    By siamadu in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-13-2009, 10:22 AM
  3. Countif statement doesn't work on some rows
    By Carpo in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-14-2006, 12:25 PM
  4. Formula bar doesn't have an equal sign
    By Joes Auto Pat in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-16-2006, 03:10 PM
  5. countif criteria only one word of few doesn't work
    By dcd123 in forum Excel Formulas & Functions
    Replies: 41
    Last Post: 09-06-2005, 07:05 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