+ Reply to Thread
Results 1 to 6 of 6

Countifs + OR function

  1. #1
    Registered User
    Join Date
    11-26-2015
    Location
    Bologna, Italy
    MS-Off Ver
    Microsoft Office 2007
    Posts
    8

    Countifs + OR function

    Hi guys,

    I need help with the following problem: I want to use a countifs function to search for a given criteria in a column A, and then find how many tokens correspond to this criteria given that one of several conditions are met in column B. This is probably not a good explanation, and I would attach an example file for you, but for some reason nothing happens when I press the attachment icon, is there a bug here or something? Used to work before...

    Anyway, say column A contains names and column B contains nationalities. I want to find out how many people are called Jack that come from either England, Scotland or the USA. So, I use countifs: I specify the first domain as A, the first criterion as Jack, then the second domain as B, and then...? How do I specify "either England, Scotland OR the USA?"

    Please help me.

    Thanks in advance,

    Espen.

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,106

    Re: Countifs + OR function

    you cannot do an OR in a countf or sumif
    its an AND function

    you could just do 3 separate countifs() and use +

    =countifs( A:A , "jack", B:B, "england" ) + countifs( A:A , "jack", B:B, "Scotland" ) +countifs( A:A , "jack", B:B, "USA" )

    probably a better way to do this

    the add attachment - works for me

    goto advanced and then manage attachments
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  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: Countifs + OR function

    Try this

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    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 Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Countifs + OR function

    One way...

    Data Range
    A
    B
    C
    D
    E
    F
    1
    Paul
    France
    Jack
    England
    3
    2
    Jack
    USA
    Scotland
    3
    Jack
    Germany
    USA
    4
    Tim
    Mexico
    5
    Sue
    Canada
    6
    Lisa
    USA
    7
    Jack
    Scotland
    8
    Jack
    France
    9
    Lynn
    USA
    10
    Jack
    England
    11
    ------
    ------
    ------
    ------
    ------
    ------


    This formula entered in F1:

    =SUMPRODUCT(COUNTIFS(A1:A10,D1,B1:B10,E1:E3))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    11-26-2015
    Location
    Bologna, Italy
    MS-Off Ver
    Microsoft Office 2007
    Posts
    8

    Re: Countifs + OR function

    Thanks for all your kind help, Tony's suggestion worked fine for me. Very useful for the future!

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

    Re: Countifs + OR function

    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/COUNTIFS function + nested user-defined function
    By shamjamali in forum Excel General
    Replies: 1
    Last Post: 05-12-2015, 09:12 PM
  2. Use COUNTIFS function on results of DATEVALUE function?
    By Si902 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-16-2015, 08:13 PM
  3. [SOLVED] Help with countifs function
    By superboy in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-14-2013, 08:35 PM
  4. [SOLVED] COUNTIFS Function Help
    By Sandpit in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-29-2012, 12:55 PM
  5. Replies: 0
    Last Post: 12-16-2011, 09:01 AM
  6. COUNTIFS function
    By RM Rilke in forum Excel General
    Replies: 11
    Last Post: 09-30-2010, 09:16 PM
  7. CountIFS using an OR function
    By Maudise in forum Excel General
    Replies: 6
    Last Post: 08-09-2010, 10:47 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