+ Reply to Thread
Results 1 to 16 of 16

Match words in 2 columns 2 sheet

  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Match words in 2 columns 2 sheet

    HI. I have 2 named sheets. First in "Spain and the other is "Temp".
    I need a macro which can compare the words in Sheet "Spain" column A8 and down with words in Sheet "Temp" Column H8 and down.
    When there is a match it have to copy from sheet "Temp" Column J to Sheet Spain Column B in the same row where it find the match from the other columns,

    So example If i have a match Sheet "Spain" Cell A8 with the word in Sheet "Temp" Cell H8(could be another cell). It have to copy word from from Column J same row to the match row and column B in Sheet "Spain2.

    I have attached a test sheet so maybe better to understand there.

    Please have a look

    Sincerely

    Abjac
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Match words in 2 columns 2 sheet

    Formula in B8 and drag it down

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Match words in 2 columns 2 sheet

    HI AB33 and thanks but it gave me this. Name in all cells. I use xp 2003 could make a difference. I would also really like a macro, because it will be a part of more sorting. If time please have a look at my test sheet.

    Thanks

    Abjac

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Match words in 2 columns 2 sheet

    I will convert in to macro, but I am not sure what an output you are expecting. For e.g, in B9, you get 1 which is LC*

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Match words in 2 columns 2 sheet

    I am still waiting a reply to post # 4 before I post the amended code.
    Oops,
    You are in excel 2003 which does not have Iferror function.

  6. #6
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Match words in 2 columns 2 sheet

    HI AB33. Yes this is correct it will be a 1. Yes i think could be the reason because i use excel 2003.

    Thanks

    Abjac

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Match words in 2 columns 2 sheet

    I have to admit that the last time I used the ISNA function was 10 years ago. The code works. The first line commented works in 2007
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Match words in 2 columns 2 sheet

    HI AB33. You nearly make me feel very old hehehe. 10 years ´maybe i should soon upgrade. The macro works perfect. Just one little thing can it be changed so it dont show the zero in column B where there is nothing. Would be great because i have to work with the data there with other macros.

    If time have a look at the last. Thanks allot
    Sincerely

    The old Abjac hehe

  9. #9
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Match words in 2 columns 2 sheet

    HI AB I solved the problem with the zero with below code. Maybe not elegant but it works fine. Thanks allot for providing the first code to solve this. Like always great help from you.

    SIncerely

    Abjac

    The code with delete zero also.

    Option Explicit

    Please Login or Register  to view this content.

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Match words in 2 columns 2 sheet

    Abjac,
    There is no need to another add another lines of code.
    Change this line
    F
    Please Login or Register  to view this content.
    The red shows if there is no match, put it 0. You can change it to what ever you like
    For instance, you can put nil values
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Match words in 2 columns 2 sheet

    HI Ab33. I tried change the code but it still give me the zero. Maybe again the old excel 2003?
    Sincerely
    Abjac

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Match words in 2 columns 2 sheet

    If there is no match, what value do you want to put in instead. It could be blank, 0 or some other text

  13. #13
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Match words in 2 columns 2 sheet

    Amended code.
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Match words in 2 columns 2 sheet

    HI AB33. Just tried it i tried that my self with replace function. But its not good it remove also zero in other numbers where there is a value. example customer bank account miss a zero in the middle. But its ok i can use the code i put in. So no need for you to work more with this, I am happy for the code you provided and my clumcy code infact do it with the zeroes,

    Thansk allot for you efford, really appriciated.

    Sincerely
    Abjac

  15. #15
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Match words in 2 columns 2 sheet

    Abjac,
    There was a bug on the replacement line, It has to include the whole match. Try it now
    Attached Files Attached Files

  16. #16
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Match words in 2 columns 2 sheet

    HI AB33. Yes of course it makes sense. It work like a charm now. Thanks allot for all the efford, really appriciated.

    Have a nice day
    Sincerely
    Abjac

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro to Compare two columns and publish sheet name in case columns dont match
    By adaws in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-06-2014, 01:21 PM
  2. Replies: 12
    Last Post: 03-29-2013, 03:02 PM
  3. Help! Count how many words in a sentence match a dictionary of words
    By sonyaelis in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-06-2013, 05:31 AM
  4. Replies: 0
    Last Post: 10-25-2012, 03:38 PM
  5. Replies: 1
    Last Post: 04-04-2012, 07:15 PM

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