+ Reply to Thread
Results 1 to 16 of 16

compare two cells

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

    compare two cells

    Column A....................................Column B
    6858 3/4 in hcs hex die.................die 1-7/16" 3/4-10nc
    20729 hex die 9/16-18nf................die 1-7/16" 9/16-18nf
    5/8 in hcs hex die.........................die 1-7/16" 5/8-18nf
    hex die 3/4-16nf............................2x4-8 SPF


    I have a spreadsheet with 17,000 lines. I want to a function that will look in A1 and see if any words in that cell match any cells in B1.



    =if("any words in A1"="anywords in B1","similar","no-match")

    Something along those lines
    Last edited by NBVC; 09-14-2011 at 12:07 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: compare two cells

    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?
    Martin

  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 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

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

    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

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: compare two cells

    But if you want your output use:

    =if(SUMPRODUCT(--(C1:L1<>""), COUNTIF(B:B,"*"&C1:L1&"*"))>0,"similar","no-match")

  6. #6
    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...

    Please Login or Register  to view this content.
    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.

  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...

    Please Login or Register  to view this content.
    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.

  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

    A slight change only:

    Please Login or Register  to view this content.

  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
    This formula is C2 might work for what you want...

    Please Login or Register  to view this content.
    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"

  10. #10
    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

  11. #11
    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

  12. #12
    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

  13. #13
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    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.

  14. #14
    Registered User
    Join Date
    09-02-2011
    Location
    Wallaroo, Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: compare two cells

    I have had a look at this and mine is slightly different, I have 2 cells each containing text each piece of text is seperated by a comma, for example in 1 cell I have :
    (cell 1)No Dogs, BBQ, Day Fees, Fees, Fire Place, Toilets, 17UPS,
    In another cell I have :
    (cell 2)Dogs, Big Rigs, Boat Ramp, Camp Kitchen, Picnic Tables, Pool, Public Phone, 26UPS,

    Now what I would like to do is compare the text in each cell and list what is different between cell 2 & cell 1

    Thanks, I hope you can help me.
    Greg

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

    Re: compare two cells

    Please read and adhere to these simple rules!

    2. Don't post a question in the thread of another member -- start your own. If you feel it's particularly relevant, provide a link to the other thread.

  16. #16
    Registered User
    Join Date
    09-02-2011
    Location
    Wallaroo, Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: compare two cells

    Sorry, I have started a new post

+ 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