+ Reply to Thread
Results 1 to 6 of 6

Countif with exception help?

  1. #1
    Registered User
    Join Date
    05-01-2019
    Location
    Tacoma, WA
    MS-Off Ver
    Google Sheets
    Posts
    2

    Countif with exception help?

    Hello,

    I am trying to make a spreadsheet that will count some values for me but not count cancelled items.

    For example, if I have a list of:

    red
    blue
    yellow
    reddish
    red-orange
    red-cancelled
    cancel-blue


    And I want to count all the *red* items, but not count the cancelled red items, how do I do this?

    If I only write =countif "red" it will not count the values like red-orange that I need

    If I write =countif ("*red*") - countif ("*cancel*") then it will subtract the cancelled blue as well.

    I cannot write =countif ("*red*") - countif ("red-cancelled"). This is for a large real data spreadsheet already in use, and people have been using both the words cancel and cancelled, and it may be at the beginning, middle or end of the phrase I need to negate.

    I have tried using some forms of <>cancel but have not been successful myself.

    Demo file should be attached.

    Thank you for your time!
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,104

    Re: Countif with exception help?

    Hi & welcome to the board.
    How about
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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

    Re: Countif with exception help?

    Okay, belt & braces approach - put this in E2:

    =COUNTIF($A$2:$A$22,"*"&C2&"*")-COUNTIF($A$2:$A$22,"*"&C2&"*cancel*")-COUNTIF($A$2:$A$22,"*cancel*"&C2&"*")

    then copy down.

    Hope this helps.

    Pete

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: Countif with exception help?

    Please try at E2 and drag down

    =COUNTIF($A$2:$A$22,"*"&C2&"*")-COUNTIFS($A$2:$A$22,"*cancel*",$A$2:$A$22,"*"&C2&"*")

    I would go with Fluff's formula
    Last edited by Bo_Ry; 05-01-2019 at 02:49 PM.

  5. #5
    Registered User
    Join Date
    05-01-2019
    Location
    Tacoma, WA
    MS-Off Ver
    Google Sheets
    Posts
    2

    Re: Countif with exception help?

    Thank you, this worked perfectly!

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,104

    Re: Countif with exception help?

    You're welcome & thanks for the feedback

+ 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. Countif Exception Advice Needed!
    By Makensmoke in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-11-2017, 01:45 PM
  2. [SOLVED] Countif with exception formula
    By martin10 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-24-2015, 09:20 AM
  3. exception of zero
    By stefrgv in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-24-2013, 11:56 AM
  4. [SOLVED] A Countif Function with Exception
    By alyaahmed in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-23-2013, 02:56 PM
  5. COM exception
    By grasyl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-25-2011, 04:41 AM
  6. find with exception
    By Hammer_757 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2009, 03:32 PM
  7. Using an IF function, with an exception
    By Renegade88 in forum Excel General
    Replies: 2
    Last Post: 10-11-2007, 10:54 AM

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