+ Reply to Thread
Results 1 to 7 of 7

Can't use match to compare two columns

Hybrid View

  1. #1
    Registered User
    Join Date
    04-15-2009
    Location
    Preston, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Can't use match to compare two columns

    Column A contains a list of 200 12 digit numbers, which includes a 6 digit part number.
    Column B contains 20, 6 digit part part numbers.

    How can I find where the numbers in column B crop up in column A?

    Match is trying to find an exact copy where i'm only looking for an identical 6 digit string.

    Thanks for any help- i've spent a few hour trawling various sites without success, just realising how little I know about excel.

  2. #2
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329

    Re: Can't use match to compare two columns

    Take a look at this post, sounds like something similar.

    http://www.excelforum.com/excel-gene...in-a-cell.html

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,702

    Re: Can't use match to compare two columns

    or you can convert the range to text within the formula so with no changes to data you can use this formula in C2 copied down

    =MATCH("*"&B2&"*",INDEX(A$2:A$250&"",0),0)

    This finds the 6 digit number anywhere with the 12 digit numbers. If it's always a specific 6 digits, say starting at position 3 then you should use a formula that would match only in that position, i.e.

    =MATCH(B2&"",INDEX(MID(A$2:A$250,3,6),0),0)
    Last edited by daddylonglegs; 04-15-2009 at 07:52 PM.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,042

    Re: Can't use match to compare two columns

    Or, if you can put numbers in columns and searched words in row you can use find link in attach...

    Book1.xls
    Never use Merged Cells in Excel

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Can't use match to compare two columns

    you can use wild cards in match
    =MATCH("*456789*",A2:A10,0) but your numbers need to be text numbers
    . so select column A data/text to columns/next/next chose "text" fom column data format
    click finish now column A will be text and you should find your partial matches
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  6. #6
    Registered User
    Join Date
    04-15-2009
    Location
    Preston, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Can't use match to compare two columns

    Thanks for the input it has helped

    I’ve used the MID function to strip away the 12 digits to 6 & place the result in the next column.
    I can now use MATCH to search the 6 digit numbers.

    A new problem is MATCH is missing some values.
    I’ve highlighted the columns & set all to text.
    Copied the value & pasted into the find tool & this finds the cell ok.
    Why would MATCH find some data & ignore other?

    Andrew

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,702

    Re: Can't use match to compare two columns

    If you use MID function to get the 6 digits then that result will be in text.

    If the lookup value is numeric then you might not get a match. Once a cell has a value changing the format of that cell to text doesn't actually change the formatting. To check whether A2 is numeric or not

    =ISNUMBER(A2)

    To ensure that lookup value is text concatenate it with "", e.g.

    =MATCH(A2&"",C2:C250,0)

    where C2:C200 contains the MID formula

+ 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