+ Reply to Thread
Results 1 to 6 of 6

Combining COUNTIF and OR [SOLVED]

  1. #1
    Registered User
    Join Date
    05-18-2010
    Location
    Thailand
    MS-Off Ver
    Excel 2003
    Posts
    2

    Combining COUNTIF and OR [SOLVED]

    hi everyone,

    In a range, by example C2:C20, I have everytime one letter of the alphabet (for the moment only A, B, C, D or E)

    I would like to count the number of As and Bs

    For the moment I have solved my problem by adding both counts:
    =COUNTIF(C2:C20,"A")+COUNTIF(C2:C20,"B")

    But since I intend to extend the range and the number of letters to count, I'd like to know if there is a way to write, by example

    =COUNTIF(C2:C20,"A" OR "B")
    Last edited by nickhk; 05-18-2010 at 04:27 AM. Reason: [solved]

  2. #2
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Childers QLD, Australia
    MS-Off Ver
    Excel 2003, 2007 & 2013
    Posts
    128

    Re: Combining COUNTIF and OR

    Hi,

    Please look at attached sheet.

    Listing the A B C... down the page works, plus fill down the countif alongside each value.

    The total is at the top.

    I hope you like

    Cheers

    TonyB

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Combining COUNTIF and OR

    TonyB appears to have misplaced the intended attachment - without knowing if I am replicating his/her suggestion, given the values are "constants" you could use:

    =SUM(COUNTIF(C2:C20,{"A","B","D"}))

    which is equivalent to

    =COUNTIF(C2:C20,"A")+COUNTIF(C2:C20,"B")+COUNTIF(C2:C20,"D")

  4. #4
    Registered User
    Join Date
    05-18-2010
    Location
    Thailand
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Combining COUNTIF and OR

    great, that works. Thanks DonkeyOte

  5. #5
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Childers QLD, Australia
    MS-Off Ver
    Excel 2003, 2007 & 2013
    Posts
    128

    Re: Combining COUNTIF and OR [SOLVED]

    Hi, again

    My appologies, I truely believed that the attachment worked.

    I have taken a slightly different approach.

    Cheers

    TonyB
    Attached Files Attached Files

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Combining COUNTIF and OR [SOLVED]

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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