+ Reply to Thread
Results 1 to 8 of 8

COUNTIF using OR

  1. #1
    PCLIVE
    Guest

    COUNTIF using OR

    I'm trying to figure a way to simplify this COUNTIF formula by using the OR
    Function. It works the way it is, but it seems like I should be able to
    make it more simple.

    =COUNTIF('Week 1'!N$3:N$10000,"CR")+COUNTIF('Week
    1'!N$3:N$10000,"ON")+COUNTIF('Week 1'!N$3:N$10000,"CC")+COUNTIF('Week
    1'!N$3:N$10000,"OR")


    I've tried this with no success.
    =COUNTIF('Week 1'!N$3:N$10000,OR("CR","ON","CC","OR"))

    Any ideas?



  2. #2
    Forum Contributor
    Join Date
    06-01-2006
    Posts
    324
    You pretty much have to do what you are doing. That's how countif works..
    Google is your best friend!

  3. #3
    Dave F
    Guest

    RE: COUNTIF using OR

    Put OR to the left of the first COUNTIF and separate each COUNTIF with a
    comma and enclose the whole thing with parentheses:

    =OR(COUNTIF('Week 1'....))

    Separate COUNTIFs with commas.

    That doesn't really simplify the formula, though, just gives it different
    syntax.
    "PCLIVE" wrote:

    > I'm trying to figure a way to simplify this COUNTIF formula by using the OR
    > Function. It works the way it is, but it seems like I should be able to
    > make it more simple.
    >
    > =COUNTIF('Week 1'!N$3:N$10000,"CR")+COUNTIF('Week
    > 1'!N$3:N$10000,"ON")+COUNTIF('Week 1'!N$3:N$10000,"CC")+COUNTIF('Week
    > 1'!N$3:N$10000,"OR")
    >
    >
    > I've tried this with no success.
    > =COUNTIF('Week 1'!N$3:N$10000,OR("CR","ON","CC","OR"))
    >
    > Any ideas?
    >
    >
    >


  4. #4
    Biff
    Guest

    Re: COUNTIF using OR

    Hi!

    Try this:

    =SUMPRODUCT(--(ISNUMBER(MATCH('Week 1'!N3:N10000,{"cr","on","cc","or"},0))))

    Biff

    "PCLIVE" <[email protected]> wrote in message
    news:%[email protected]...
    > I'm trying to figure a way to simplify this COUNTIF formula by using the
    > OR Function. It works the way it is, but it seems like I should be able
    > to make it more simple.
    >
    > =COUNTIF('Week 1'!N$3:N$10000,"CR")+COUNTIF('Week
    > 1'!N$3:N$10000,"ON")+COUNTIF('Week 1'!N$3:N$10000,"CC")+COUNTIF('Week
    > 1'!N$3:N$10000,"OR")
    >
    >
    > I've tried this with no success.
    > =COUNTIF('Week 1'!N$3:N$10000,OR("CR","ON","CC","OR"))
    >
    > Any ideas?
    >




  5. #5
    Biff
    Guest

    Re: COUNTIF using OR

    Another way:

    =SUM(COUNTIF('Week 1'!N3:N10000,{"cr","on","cc","or"}))

    Biff

    "Biff" <[email protected]> wrote in message
    news:[email protected]...
    > Hi!
    >
    > Try this:
    >
    > =SUMPRODUCT(--(ISNUMBER(MATCH('Week
    > 1'!N3:N10000,{"cr","on","cc","or"},0))))
    >
    > Biff
    >
    > "PCLIVE" <[email protected]> wrote in message
    > news:%[email protected]...
    >> I'm trying to figure a way to simplify this COUNTIF formula by using the
    >> OR Function. It works the way it is, but it seems like I should be able
    >> to make it more simple.
    >>
    >> =COUNTIF('Week 1'!N$3:N$10000,"CR")+COUNTIF('Week
    >> 1'!N$3:N$10000,"ON")+COUNTIF('Week 1'!N$3:N$10000,"CC")+COUNTIF('Week
    >> 1'!N$3:N$10000,"OR")
    >>
    >>
    >> I've tried this with no success.
    >> =COUNTIF('Week 1'!N$3:N$10000,OR("CR","ON","CC","OR"))
    >>
    >> Any ideas?
    >>

    >
    >




  6. #6
    Bob Phillips
    Guest

    Re: COUNTIF using OR

    But you don't have to restrict yourself

    =SUMPRODUCT(COUNTIF('Week 1'!N$3:N$10000,{"CR","ON","CC","OR"}))

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Bearacade" <[email protected]> wrote
    in message news:[email protected]...
    >
    > You pretty much have to do what you are doing. That's how countif
    > works..
    >
    >
    > --
    > Bearacade
    >
    >
    > ------------------------------------------------------------------------
    > Bearacade's Profile:

    http://www.excelforum.com/member.php...o&userid=35016
    > View this thread: http://www.excelforum.com/showthread...hreadid=572763
    >




  7. #7
    Sloth
    Guest

    RE: COUNTIF using OR

    =SUMPRODUCT(--(A1:A10={"CR","ON","CC","OR"}))

    should work. COUNTIF doesn't have a way to include OR.


    "PCLIVE" wrote:

    > I'm trying to figure a way to simplify this COUNTIF formula by using the OR
    > Function. It works the way it is, but it seems like I should be able to
    > make it more simple.
    >
    > =COUNTIF('Week 1'!N$3:N$10000,"CR")+COUNTIF('Week
    > 1'!N$3:N$10000,"ON")+COUNTIF('Week 1'!N$3:N$10000,"CC")+COUNTIF('Week
    > 1'!N$3:N$10000,"OR")
    >
    >
    > I've tried this with no success.
    > =COUNTIF('Week 1'!N$3:N$10000,OR("CR","ON","CC","OR"))
    >
    > Any ideas?
    >
    >
    >


  8. #8
    PCLIVE
    Guest

    Re: COUNTIF using OR

    These have all been good suggestions, some of which worked and others did
    not appear to. However, I have gone with yours, Biff, as it appears to be
    the simplist one.

    =SUM(COUNTIF('Week 1'!N3:N10000,{"cr","on","cc","or"}))

    Thanks to all.
    Paul

    "Biff" <[email protected]> wrote in message
    news:[email protected]...
    > Another way:
    >
    > =SUM(COUNTIF('Week 1'!N3:N10000,{"cr","on","cc","or"}))
    >
    > Biff
    >
    > "Biff" <[email protected]> wrote in message
    > news:[email protected]...
    >> Hi!
    >>
    >> Try this:
    >>
    >> =SUMPRODUCT(--(ISNUMBER(MATCH('Week
    >> 1'!N3:N10000,{"cr","on","cc","or"},0))))
    >>
    >> Biff
    >>
    >> "PCLIVE" <[email protected]> wrote in message
    >> news:%[email protected]...
    >>> I'm trying to figure a way to simplify this COUNTIF formula by using the
    >>> OR Function. It works the way it is, but it seems like I should be able
    >>> to make it more simple.
    >>>
    >>> =COUNTIF('Week 1'!N$3:N$10000,"CR")+COUNTIF('Week
    >>> 1'!N$3:N$10000,"ON")+COUNTIF('Week 1'!N$3:N$10000,"CC")+COUNTIF('Week
    >>> 1'!N$3:N$10000,"OR")
    >>>
    >>>
    >>> I've tried this with no success.
    >>> =COUNTIF('Week 1'!N$3:N$10000,OR("CR","ON","CC","OR"))
    >>>
    >>> Any ideas?
    >>>

    >>
    >>

    >
    >




+ 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