+ Reply to Thread
Results 1 to 3 of 3

Count if match any of 3 strings

  1. #1
    Registered User
    Join Date
    11-30-2005
    Posts
    4

    Question Count if match any of 3 strings

    I'm using this formula and looking for a way to simplify it.

    =SUM((COUNTIF(E5:E41,"DL380")*2),(COUNTIF(E5:E41,"DL580")*4), (COUNTIF(E5:E41,"RP4400")*4), (COUNTIF(E5:E41,"DL585")*4))

    As more models get added it will become tougher to maintain. I'm trying to say count all the cells with "RP4400, DL580 or DL585" in them. The list will grow. Is there a way to say count if it matches "any value stored in this range"?

  2. #2
    Peo Sjoblom
    Guest

    Re: Count if match any of 3 strings

    A couple of ways

    =SUMPRODUCT((E5:E41={"DL380","DL580","RP4400","DL585"})*({2,4,4,4}))

    or


    =SUMPRODUCT(COUNTIF(E5:E41,{"DL380","DL580","RP4400","DL585"}),({2,4,4,4}))


    --

    Regards,

    Peo Sjoblom

    "GGG" <[email protected]> wrote in message
    news:[email protected]...
    >
    > I'm using this formula and looking for a way to simplify it.
    >
    > =SUM((COUNTIF(E5:E41,"DL380")*2),(COUNTIF(E5:E41,"DL580")*4),
    > (COUNTIF(E5:E41,"RP4400")*4), (COUNTIF(E5:E41,"DL585")*4))
    >
    > As more models get added it will become tougher to maintain. I'm
    > trying to say count all the cells with "RP4400, DL580 or DL585" in
    > them. The list will grow. Is there a way to say count if it matches
    > "any value stored in this range"?
    >
    >
    > --
    > GGG
    > ------------------------------------------------------------------------
    > GGG's Profile:

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




  3. #3
    Domenic
    Guest

    Re: Count if match any of 3 strings

    Try...

    =SUMPRODUCT(COUNTIF(E5:E41,{"DL380","DL580","RP4400","DL585"}),{2,4,4,4})

    or

    =SUMPRODUCT(COUNTIF(E5:E41,A1:A4),B1:B4)

    ....where A1:B4 contains the following table...

    DL380 2
    DL580 4
    RP4400 4
    DL585 4

    Hope this helps!

    In article <[email protected]>,
    GGG <[email protected]> wrote:

    > I'm using this formula and looking for a way to simplify it.
    >
    > =SUM((COUNTIF(E5:E41,"DL380")*2),(COUNTIF(E5:E41,"DL580")*4),
    > (COUNTIF(E5:E41,"RP4400")*4), (COUNTIF(E5:E41,"DL585")*4))
    >
    > As more models get added it will become tougher to maintain. I'm
    > trying to say count all the cells with "RP4400, DL580 or DL585" in
    > them. The list will grow. Is there a way to say count if it matches
    > "any value stored in this range"?


+ 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