+ Reply to Thread
Results 1 to 6 of 6

Find correct patterns with "?" as a wildcard

  1. #1
    Forum Contributor
    Join Date
    03-16-2007
    Location
    Berlin, Germany
    MS-Off Ver
    Excel 2007
    Posts
    202

    Find correct patterns with "?" as a wildcard

    Hi!
    I need a formula which will return the number of correct patterns in column C, which correspond to each of the entries in column A.
    In the patterns, the wildcard "?" substitutes any letter, but only one. For example, there are TWO patterns in column C which both correspond to the word GEORGE in column A; but none of the patterns corresponds to CHRIS (because CH???S has one character more).

    It's easy to do it the other way round, but I need it this way... any ideas?

    Example:
    A .......................B (results) ........... C
    ROBERT ............1 .........................A??X
    CHRIS.................0 ........................GE?RG?
    GEORGE............2..........................R?BERT
    ALEX..................1..........................CH???S
    ......................................................?EORGE

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Find correct patterns with "?" as a wildcard

    =sumif($a$2:$a$5,c2,$b$2:$b$5)
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Find correct patterns with "?" as a wildcard

    Do you mean ?

    B1: =SUMPRODUCT(COUNTIF($A1,$C$1:$C$5))
    copied down

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Find correct patterns with "?" as a wildcard

    Ooops! I see I was working the other way in terms of matching.

  5. #5
    Forum Contributor
    Join Date
    03-16-2007
    Location
    Berlin, Germany
    MS-Off Ver
    Excel 2007
    Posts
    202

    Re: Find correct patterns with "?" as a wildcard

    DonkeyOte, it works, but it's kinda heavy and slow...
    is there any other way?

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Find correct patterns with "?" as a wildcard

    I wouldn't envisage the formula to be too horrendous unless you have very large range references ... please provide an example of your final formula.

    Whenever you use SUMPRODUCT it's generally advisable to keep ranges as lean as possible.

+ 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