+ Reply to Thread
Results 1 to 10 of 10

Count cells but exclude 2 values

  1. #1
    Registered User
    Join Date
    09-13-2012
    Location
    Glasgow
    MS-Off Ver
    Excel 2007
    Posts
    16

    Count cells but exclude 2 values

    Hi

    I have a list of 19 items in column D, i want to count them but exclude 2 specific items "Bags" and "Shoes"

    I've tried a couple different ways but I can't get it to work.

    I am using the range D:D as there will be more items added to the list
    Last edited by Karen13; 09-17-2015 at 05:54 AM.

  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: Count cells but exclude 2 values

    Maybe something like this...

    =COUNTA(D:D)-SUM(COUNTIF(D:D,{"Shoes","Bags"}))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    09-13-2012
    Location
    Glasgow
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Count cells but exclude 2 values

    Awesome thank you that worked perfectly!!

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Count cells but exclude 2 values

    Perhaps

    =SUMPRODUCT(--(ISTEXT(D:D)), --(D:D <> "shoes"),--(D:D <>"bags"))
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

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

    Re: Count cells but exclude 2 values

    You're welcome. Thanks for the feedback!

  6. #6
    Registered User
    Join Date
    09-13-2012
    Location
    Glasgow
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Count cells but exclude 2 values

    Would I also be able to add to =COUNTA(D:D)-SUM(COUNTIF(D:D,{"Shoes","Bags"})) where column F must contain the word "Return"?

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Count cells but exclude 2 values

    I think

    =COUNTIF(F:F, "Return")- SUM(COUNTIFS(D:D,{"Shoes","Bags"}, F:F, "Return"))
    as you'd only want to subtract shoes and bags that were returned

  8. #8
    Registered User
    Join Date
    09-13-2012
    Location
    Glasgow
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Count cells but exclude 2 values

    Sorry to waste time, I realised what I was doing wrong.. the "Bags" text was a header and I didnt need to count it if i started with the "Return" count

    =COUNTIF('F:F,"Return")-COUNTIF(D:D,"Shoes")

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

    Re: Count cells but exclude 2 values

    Quote Originally Posted by Karen13 View Post
    Would I also be able to add to =COUNTA(D:D)-SUM(COUNTIF(D:D,{"Shoes","Bags"})) where column F must contain the word "Return"?
    Maybe this...

    Data Range
    D
    E
    F
    1
    Item
    ------
    Status
    2
    shoes
    stock
    3
    bags
    return
    4
    cans
    return
    5
    flowers
    ship
    6
    gowns
    return
    7
    shoes
    ship
    8
    bags
    stock
    9
    hats
    return
    10
    11
    12
    13
    14
    15


    =SUMPRODUCT(--(D2:D15<>""),--ISNA(MATCH(D2:D15,{"Shoes","Bags"},0)),--(F2:F15="Return"))

    Result = 3

  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: Count cells but exclude 2 values

    Quote Originally Posted by ChemistB View Post
    Perhaps

    =SUMPRODUCT(--(ISTEXT(D:D)), --(D:D <> "shoes"),--(D:D <>"bags"))
    Ouch! Not with entire column references, though!
    Click * below if this answer helped

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

+ 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. Average of last 5 values but to exclude any blank cells.
    By tb2000 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 01-12-2019, 03:14 PM
  2. [SOLVED] Exclude writing values from empty cells with formulas
    By britzer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-17-2013, 06:47 AM
  3. Count values in column but exclude filtered rows
    By elee532 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-26-2013, 12:53 AM
  4. [SOLVED] Count entries with formulas, exclude blank values
    By JO505 in forum Excel General
    Replies: 4
    Last Post: 03-08-2013, 08:16 PM
  5. [SOLVED] Count number of cells that contain text but exclude cells that contain quotation marks
    By Cantyman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-22-2012, 03:57 PM
  6. [SOLVED] Count Nonblank cells and exclude Sub Totals
    By Seve in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 04-23-2012, 01:17 PM
  7. How to average cells but exclude 0 values?
    By Billznik in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-27-2008, 06:26 AM

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