+ Reply to Thread
Results 1 to 3 of 3

COUNTIF for multiple values

  1. #1
    Registered User
    Join Date
    11-28-2007
    Posts
    18

    COUNTIF for multiple values

    Hi Guys,

    I have a formula that counts the number of cells in a range that do not have a certain value in.

    =(COUNTIF(C5:I5,"<>A"))

    I need to expand this so that the formula gives a count for all cells within the range that either:

    DO NOT have multiple values "A", "S", "T", or "H"
    or
    DO have values "Y" or "N"

    Can anybody point me in the right direction.

    Thanks in advance.
    Mark

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Do you want the Y's and N's to be counted twice? Because they would fit both conditions.

    If yes:

    =SUMPRODUCT((C5:I5<>"")*ISNA(MATCH(C5:I5,{"A","S","T","H"},0))+ISNUMBER(MATCH(C5:I5,{"Y","N"},0)))

    if no:

    =SUMPRODUCT((C5:I5<>"")*ISNA(MATCH(C5:I5,{"A","S","T","H","Y","N"},0))+ISNUMBER(MATCH(C5:I5,{"Y","N"},0)))

    Note: I also took into account not wanting to count blanks (in case there are any).
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    11-28-2007
    Posts
    18
    Hi NBVC

    The answer was no...and it works a treat.

    Thanks a mil!

    mark.

+ 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