+ Reply to Thread
Results 1 to 10 of 10

Replacing references in two columns

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-09-2009
    Location
    Greece
    MS-Off Ver
    Office 365
    Posts
    133

    Replacing references in two columns

    I have 2 colums like this. And I want whenever there is a reference like this βλ. "some word" in column 2, to have the macro look up some word entry in column 1, find the text in the same row in column 2 and replace the βλ. "some word" reference with the text found in column 2. (See attached, sheet 1 as it is, sheet 2 as I want it to be).

    Sheet 1

    another word βλ. "some word"
    aword μετάφραση
    bword βλ. "aword"
    some word κάποια λέξη


    Sheet 2

    another word κάποια λέξη
    aword μετάφραση
    bword μετάφραση
    some word κάποια λέξη
    Attached Files Attached Files
    Last edited by greek; 10-31-2009 at 04:46 AM.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Replacing references in two columns

    Hi,

    use this formula in C1 and copy down

    =IF(LEFT(B1,3)="βλ.",VLOOKUP(MID(B1,6,LEN(B1)-6),$A$1:$B$100,2,FALSE),B1)

    Column C now has the list you want. You can then copy column C and use Paste Special - Values to paste the list into colum B. Finally delete Column C, as it is no longer needed.

    does that help?

  3. #3
    Forum Contributor
    Join Date
    06-09-2009
    Location
    Greece
    MS-Off Ver
    Office 365
    Posts
    133

    Re: Replacing references in two columns

    Thanks, tried it but gives me an error:

    http://lh6.ggpht.com/_Z6S8BcbaPTU/Su...-30_000001.png

  4. #4
    Forum Contributor
    Join Date
    06-09-2009
    Location
    Greece
    MS-Off Ver
    Office 365
    Posts
    133

    Re: Replacing references in two columns

    Replaced all the commas with ; and now at the cells with the reference it gives me:

    #N/A

    and the other cells simply copying what is in column 2.
    Last edited by greek; 10-29-2009 at 06:28 PM.

  5. #5
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Replacing references in two columns

    Check the formula again. compare with the attached. Although this is Greek to me, the formula seems to work ...

  6. #6
    Forum Contributor
    Join Date
    06-09-2009
    Location
    Greece
    MS-Off Ver
    Office 365
    Posts
    133

    Re: Replacing references in two columns

    For some strange reason no, even when I add the list in your sheet and drag it down.
    Although with the 4 rows in your sheet it does work.

    I am guessing here, is it because at least in one of the cases, there is no exact same reference value, and as a result, all other instances fail?

    http://lh6.ggpht.com/_Z6S8BcbaPTU/Su...-30_024950.png

    See attachment.
    Last edited by greek; 10-29-2009 at 09:02 PM.

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Replacing references in two columns

    there is no exact same reference value, and as a result, all other instances fail?
    not really. If the formula bombs in one cell, the others should be unaffected. Can you post a sample of your real data with the error appearing?

  8. #8
    Forum Contributor
    Join Date
    06-09-2009
    Location
    Greece
    MS-Off Ver
    Office 365
    Posts
    133

    Re: Replacing references in two columns

    I have done so; in the post above.

  9. #9
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Replacing references in two columns

    Ahhh . Found it

    =IF(LEFT(B1,3)="βλ.",VLOOKUP(MID(B1,6,LEN(B1)-6),$A$1:$B$4,2,FALSE),B1)

    This is the formula in C2. You need to change the red bit to be the last row of your list. If your list is 1000 words, it'll be $B$1001. Currently the formula works only for the first 4 rows

    hth

  10. #10
    Forum Contributor
    Join Date
    06-09-2009
    Location
    Greece
    MS-Off Ver
    Office 365
    Posts
    133

    Re: Replacing references in two columns

    Yep, it works, many 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