+ Reply to Thread
Results 1 to 6 of 6

Countif with Multiple Wildcard Criteria

  1. #1
    Forum Contributor
    Join Date
    09-13-2005
    Posts
    114

    Countif with Multiple Wildcard Criteria

    Hello,

    I'm trying to come up with a formula to count that number of item's that match mulitple criteria. In order to find a match I need to look inside a cell's text and look for specific letters or numbers.

    In Column A I have a bunch of numbers and in column B are a bunch of sentences. There are 10,000 or so row's of data for each column. I need a formula that will first look for a matching number from Column A and then will allow me to enter anywhere from 2 to 5 wildcard phrases to search for in column B. The formula should then count all of the matches

    So for example I might want to look for the number 5405 in column A and then for the phrases "E54", "NB3", and "Heritage" in column B and give me a total count for all matches.

    Any help would be greatly appreciated

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Countif with Multiple Wildcard Criteria

    Which version of Excel?

    In 2007 or later you can use COUNTIFS

    =SUM(COUNTIFS(A2:A10000,5405,B2:B10000,"*"&{"E54","NB3","Heritage"}&"*"))
    Audere est facere

  3. #3
    Forum Contributor
    Join Date
    09-13-2005
    Posts
    114

    Re: Countif with Multiple Wildcard Criteria

    If have 2007 but some of the people who will use the sheet might have 2003

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Countif with Multiple Wildcard Criteria

    Perhaps something like:

    =SUMPRODUCT(--(A1:A10=5405),--ISNUMBER(MATCH(B1:B10,{"E54","NB3","Heritage"},0)))

    adjust ranges to suit, you can replace the criteria with cell references... the { } would be replaced with a range.
    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.

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Countif with Multiple Wildcard Criteria

    I think the E54 etc. values appear within other text, is that right?

    One way for Excel 2003 would be

    =SUMPRODUCT((A2:A10000=5405)*ISNUMBER(SEARCH({"E54","NB3","Heritage"},B2:B10000)))

    Note: that might double count a single row if, say E54 and Heritage both appear in the same cell in column B.....is that a possibility?

  6. #6
    Forum Contributor
    Join Date
    09-13-2005
    Posts
    114

    Re: Countif with Multiple Wildcard Criteria

    Thanks for all your help

+ 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