+ Reply to Thread
Results 1 to 6 of 6

How do you count data that matches more than one condition?

  1. #1
    ryesworld
    Guest

    How do you count data that matches more than one condition?

    Hi All:
    I need a formula that will count the number of occurences that a column
    contains either "text string A" or "text string B".

  2. #2
    Bob Umlas
    Guest

    Re: How do you count data that matches more than one condition?

    =SUMPRODUCT(--(Range={"text string A","text string B"}))
    Bob Umlas
    Excel MVP

    "ryesworld" <ryesworld@discussions.microsoft.com> wrote in message
    news:3F69E78D-C851-49C4-BF8E-755852609135@microsoft.com...
    > Hi All:
    > I need a formula that will count the number of occurences that a column
    > contains either "text string A" or "text string B".




  3. #3
    Biff
    Guest

    Re: How do you count data that matches more than one condition?

    Hi!

    Try one of these:

    =COUNTIF(A1:A10,"textA")+COUNTIF(A1:A10,"textB")

    =SUMPRODUCT(--(ISNUMBER(MATCH(A1:A10,{"textA","textB"},0))))

    Biff

    "ryesworld" <ryesworld@discussions.microsoft.com> wrote in message
    news:3F69E78D-C851-49C4-BF8E-755852609135@microsoft.com...
    > Hi All:
    > I need a formula that will count the number of occurences that a column
    > contains either "text string A" or "text string B".




  4. #4
    RagDyer
    Guest

    Re: How do you count data that matches more than one condition?

    Another way:

    =SUM(COUNTIF(A:A,{"aa","bb"}))
    --
    HTH,

    RD
    ==============================================
    Please keep all correspondence within the Group, so all may benefit!
    ==============================================


    "ryesworld" <ryesworld@discussions.microsoft.com> wrote in message
    news:3F69E78D-C851-49C4-BF8E-755852609135@microsoft.com...
    > Hi All:
    > I need a formula that will count the number of occurences that a column
    > contains either "text string A" or "text string B".



  5. #5
    ryesworld
    Guest

    Re: How do you count data that matches more than one condition?

    Hi RagDyer...

    I'd like to use your formula, "=SUM(COUNTIF(Sheet1!E1:E20,{"aa","bb"}))",
    with your other formula from my other posting,
    "=SUMPRODUCT((Sheet1!A1:A20=C1)*(Sheet1!B1:B20=D1))". In other words,
    Sheet1!B1:B20=D1 or D2. (D1 is "aa" and D2 is "bb"). A number count should
    only be retuned if all data ranges are true. (ie: if a zero was retuned from
    either formula, zero will be the answer)

    I hope that makes sense....

    "RagDyer" wrote:

    > Another way:
    >
    > =SUM(COUNTIF(A:A,{"aa","bb"}))
    > --
    > HTH,
    >
    > RD
    > ==============================================
    > Please keep all correspondence within the Group, so all may benefit!
    > ==============================================
    >
    >
    > "ryesworld" <ryesworld@discussions.microsoft.com> wrote in message
    > news:3F69E78D-C851-49C4-BF8E-755852609135@microsoft.com...
    > > Hi All:
    > > I need a formula that will count the number of occurences that a column
    > > contains either "text string A" or "text string B".

    >
    >


  6. #6
    RagDyer
    Guest

    Re: How do you count data that matches more than one condition?

    Don't know if I quite follow you.

    Is this what you're looking for:

    =SUMPRODUCT((Sheet1!A1:A20=C1)*(Sheet1!B1:B20={"aa","bb"}))

    OR, do you want to reference particular cells, instead of hard coding the
    actual text:

    =SUMPRODUCT((Sheet1!A1:A20=C1)*((Sheet1!B1:B20=D1)+(Sheet1!B1:B20=D2)))

    --
    HTH,

    RD
    ==============================================
    Please keep all correspondence within the Group, so all may benefit!
    ==============================================


    "ryesworld" <ryesworld@discussions.microsoft.com> wrote in message
    news:C0D21DD5-487C-4270-AB44-125AA2CEEFE4@microsoft.com...
    > Hi RagDyer...
    >
    > I'd like to use your formula, "=SUM(COUNTIF(Sheet1!E1:E20,{"aa","bb"}))",
    > with your other formula from my other posting,
    > "=SUMPRODUCT((Sheet1!A1:A20=C1)*(Sheet1!B1:B20=D1))". In other words,
    > Sheet1!B1:B20=D1 or D2. (D1 is "aa" and D2 is "bb"). A number count

    should
    > only be retuned if all data ranges are true. (ie: if a zero was retuned

    from
    > either formula, zero will be the answer)
    >
    > I hope that makes sense....
    >
    > "RagDyer" wrote:
    >
    > > Another way:
    > >
    > > =SUM(COUNTIF(A:A,{"aa","bb"}))
    > > --
    > > HTH,
    > >
    > > RD
    > > ==============================================
    > > Please keep all correspondence within the Group, so all may benefit!
    > > ==============================================
    > >
    > >
    > > "ryesworld" <ryesworld@discussions.microsoft.com> wrote in message
    > > news:3F69E78D-C851-49C4-BF8E-755852609135@microsoft.com...
    > > > Hi All:
    > > > I need a formula that will count the number of occurences that a

    column
    > > > contains either "text string A" or "text string B".

    > >
    > >



+ 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