+ Reply to Thread
Results 1 to 6 of 6

COUNTIF with OR Logic

  1. #1
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    COUNTIF with OR Logic

    I now know from MS documentation that COUNTIFS does not support OR functionality.

    I am attempting to count the number of times two criteria are met. In a defined range in column A, the values must be 1, 2, or 3, etc. and in column B the values must be 11, 15, or 16. My attempt thus far (which as stated earlier I now know to be incorrect):

    Please Login or Register  to view this content.
    If I were programming it, I would just loop the ranges with the value tests in another array and increment a counter when true. Surely I don't have to go this route...

    Please assist.

    Thanks.
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: COUNTIF with OR Logic

    Try this regular formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: COUNTIF with OR Logic

    Unable to test without your file but maybe this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: COUNTIF with OR Logic

    Hi

    Have you tried something like

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: COUNTIF with OR Logic

    Quote Originally Posted by Ron Coderre View Post
    Try this regular formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Is that something you can work with?
    It does Ron. I'll research why after-hours. Fun stuff, I know.

    Thanks!

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: COUNTIF with OR Logic

    maybe

    =SUMPRODUCT(COUNTIFS(PCodes,{1,2,3,4,5,6,9,10,13,14,15,16,17,18,19},Regions,{11;15;16}))
    Josie

    if at first you don't succeed try doing it the way your wife told you to

+ 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 and Date Logic
    By Blofeld in forum Excel General
    Replies: 3
    Last Post: 11-20-2011, 10:28 AM
  2. if(countif(if...logic help
    By step_one in forum Excel General
    Replies: 5
    Last Post: 09-23-2011, 11:46 AM
  3. Excel countif and logic
    By Kainmc in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-16-2008, 12:43 PM
  4. [SOLVED] Countif Using Multiple Logic Tests
    By Carl in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-04-2006, 02:15 AM
  5. [SOLVED] COUNTIF with Logic?
    By Leonhardtk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-10-2006, 07:15 PM

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