+ Reply to Thread
Results 1 to 16 of 16

compare two cells

Hybrid View

  1. #1
    Registered User
    Join Date
    11-10-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: compare two cells

    Quote Originally Posted by mrice View Post
    In this case, what do you define as a word?

    Is it any characters (including numbers) between two spaces or at the start/end of the string?

    Or do you want to exclude substrings which contain numbers?


    I want to compare anything. Numbers/Letters or combo. These would be defined withing a space on both sides of the word.

    Example: 6858 3/4 in hcs hex die

    "6858" , "3/4" , "in" , "hcs" , "hex" , "die" are all words

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

    Re: compare two cells

    You can:

    Insert one more column in A (for result)
    Switch (former) A and B column (now B and C) so B became C and viceversa.
    Select C column and Data -> Text to columns -> Delimited and use space for delimiter
    in A column write: =SUMPRODUCT(--(C1:L1<>""), COUNTIF(B:B;"*"&C1:L1&"*")) and pull down.

    If result is greater then 0 you have match.
    I left number so you can hoe many matches you get.
    Attached Files Attached Files
    Never use Merged Cells in Excel

  3. #3
    Registered User
    Join Date
    11-10-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: compare two cells

    Quote Originally Posted by zbor View Post
    You can:

    Insert one more column in A (for result)
    Switch (former) A and B column (now B and C) so B became C and viceversa.
    Select C column and Data -> Text to columns -> Delimited and use space for delimiter
    in A column write: =SUMPRODUCT(--(C1:L1<>""), COUNTIF(B:B;"*"&C1:L1&"*")) and pull down.

    If result is greater then 0 you have match.
    I left number so you can hoe many matches you get.
    I can't get this to give good readings either.

    691....... MOWER BLADE 20"MURRAY......... BLACK PVC BOOT 7-SZ


    This one yielded a 691 in your formula. Dosn't seem right

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

    Re: compare two cells

    Quote Originally Posted by roycettu View Post
    I can't get this to give good readings either.

    691....... MOWER BLADE 20"MURRAY......... BLACK PVC BOOT 7-SZ


    This one yielded a 691 in your formula. Dosn't seem right
    That was before I am only comparing the two cells within the row. So it's 691 match in ALL columns.

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

    Re: compare two cells

    This formula is C2 might work for what you want...

    =IF(SUMPRODUCT(--ISNUMBER(MATCH("*"&TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",100)),1+(100*(ROW(INDIRECT("1:"&LEN(A2)-LEN(SUBSTITUTE(A2," ",""))+1))-1)),100))&"*",$B$2:$B$5,0))),"similar","no match")
    In your case the word "die" exists in all the column A entries, and therefore they will all have matches in column B
    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.

  6. #6
    Registered User
    Join Date
    11-10-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: compare two cells

    Quote Originally Posted by NBVC View Post
    This formula is C2 might work for what you want...

    =IF(SUMPRODUCT(--ISNUMBER(MATCH("*"&TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",100)),1+(100*(ROW(INDIRECT("1:"&LEN(A2)-LEN(SUBSTITUTE(A2," ",""))+1))-1)),100))&"*",$B$2:$B$5,0))),"similar","no match")
    In your case the word "die" exists in all the column A entries, and therefore they will all have matches in column B


    Sorry, should of been more clearly, I am only comparing the two cells within the row.

    a1 to b1
    a2 to b2 etc.

  7. #7
    Registered User
    Join Date
    11-10-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: compare two cells

    Quote Originally Posted by NBVC View Post
    This formula is C2 might work for what you want...

    =IF(SUMPRODUCT(--ISNUMBER(MATCH("*"&TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",100)),1+(100*(ROW(INDIRECT("1:"&LEN(A2)-LEN(SUBSTITUTE(A2," ",""))+1))-1)),100))&"*",$B$2:$B$5,0))),"similar","no match")
    In your case the word "die" exists in all the column A entries, and therefore they will all have matches in column B
    I tinkered with this and couldn't get it to work

    Example

    WAND BRASS 12 CURVED".................. WAND BRASS 12" CURVED

    This yields a "no match"

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

    Re: compare two cells

    I don't. See attached.

    Note that the first 3 matched, but Curved" didn't due to the " at the end of the word.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    11-10-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: compare two cells

    Quote Originally Posted by NBVC View Post
    I don't. See attached.

    Note that the first 3 matched, but Curved" didn't due to the " at the end of the word.
    Not sure what the diff was but this is working now once I took the formula from your spreadsheet and pasted it into note pad and re-copied/pasted back into excel.

    I think this will lighten the workload a bit.

    Thanks

+ 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