+ Reply to Thread
Results 1 to 4 of 4

Countifs?

  1. #1
    Registered User
    Join Date
    02-10-2014
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2013
    Posts
    25

    Countifs?

    So, I thought I was aweseome & and had a solution, but I don't.... I ended up doubling my count...

    What I'm trying to do/say:

    Determine all of the WINDOWS (column A), that are 2015 (column B), if DOG or CAT exists in column C.

    This does not work, because it doubles my numbers:
    Please Login or Register  to view this content.
    I would manually filter in excel as follows:
    Column A - Windows
    Column B - 2015
    Column C - Text Filter: Contains dog OR Contains cat

    Using the example data below, the answer would be 5 (not 8, like my SUM statement above)


    Example data below -
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: Countifs?

    COUNTIFS is inherently an "AND" function, not necessarily an "OR" function. You are correct when using SUM to add in an "OR" criteria, but the double counts are stemming from the cells containing multiple values, which Excel doesn't like. If you can't alter your data in such a way that each animal is assigned their own cell and/or column, VBA may be your best bet with this.
    Spread the love, add to the Rep

    "None of us are as smart as all of us."

  3. #3
    Registered User
    Join Date
    02-10-2014
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2013
    Posts
    25

    Re: Countifs?

    Thanks mamahobt - Altering the data is not an option (I'm receiving a report) and I'm linking to the data.

  4. #4
    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: Countifs?

    Maybe with a helper column

    =SUM(COUNTIFS($A$2:$A$17,D1,$F$2:$F$17,E1,$C$2:$C$17,"*"&{"cat","dog"}&"*"))

    Row\Col
    A
    B
    C
    D
    E
    F
    1
    Server Year Input Windows
    2014
    Year
    2
    Windows
    2/2/2015
    dog
    4
    2015
    3
    Unix
    2/2/2015
    cat
    2015
    4
    Windows
    2/2/2015
    fish
    2015
    5
    Windows
    2/2/2015
    dog, cat
    2015
    6
    Windows
    2/2/2015
    cat
    2015
    7
    Windows
    2/2/2015
    fish, cat,dog
    2015
    8
    Windows
    2/2/2015
    cat
    2015
    9
    Unix
    2/2/2015
    fish, cat,dog
    2015
    10
    Windows
    2/2/2015
    fish
    2015
    11
    Unix
    2/2/2015
    fish
    2015
    12
    Windows
    1/1/2014
    dog, cat
    2014
    13
    Unix
    2/2/2015
    dog
    2015
    14
    Windows
    2/2/2015
    cat
    2015
    15
    Unix
    2/2/2015
    fish, dog
    2015
    16
    Windows
    1/1/2014
    fish, dog
    2014
    17
    Windows
    1/1/2014
    dog
    2014


    Or without helper column

    =SUM(COUNTIFS($A$2:$A$17,D1,$B$2:$B$17,">=1/1/2014",$B$2:$B$17,"<=12/31/2014",$C$2:$C$17,"*"&{"cat","dog"}&"*"))
    Last edited by AlKey; 03-06-2015 at 01:41 PM.
    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

+ 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] Countifs + Countifs - replacement?
    By JulieQ in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-05-2015, 03:02 PM
  2. [SOLVED] Countifs ('a', 'b', 'c or d')
    By Bagli1 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 10-16-2013, 08:07 AM
  3. COUNTIFS OR COUNTIFS needs to work
    By joshbellfi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-23-2013, 10:55 AM
  4. COUNTIFS OR...multiple countifs without duplication in the numbers
    By HooligaD in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-21-2012, 09:53 AM
  5. Replies: 0
    Last Post: 12-16-2011, 09:01 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