+ Reply to Thread
Results 1 to 8 of 8

Large replacement

  1. #1
    Registered User
    Join Date
    02-11-2012
    Location
    London, England
    MS-Off Ver
    2021
    Posts
    41

    Large replacement

    I have a sheet with several thousand unique strings in one column.
    On another sheet, I have this same list in one column each with a proposed replacement in the adjacent column.
    The order however is not consistent.

    Any way within Excel to use sheet 2 as a master set of patterns for a search and replace?

    Thanks!
    Last edited by ritmo2k; 03-16-2012 at 11:45 AM.

  2. #2
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Large replacement

    could you attach a cample sheet so that we can get a better idea of what you are trying to do?
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  3. #3
    Registered User
    Join Date
    02-11-2012
    Location
    London, England
    MS-Off Ver
    2021
    Posts
    41

    Re: Large replacement

    Sheet 1 below:

    A B
    1 foo 987987087
    2 bar 674564759
    3 biz 785654564
    4 baz 785685685

    Sheet 2 below:

    A B
    1 foo John
    2 bar Jane
    3 biz Mary
    4 baz Nancy


    So, the lists are large, I need to search sheet1-CellA for matches in sheet2-CellA, if one is found, replace Sheet1-CellAn with Sheet2-CellBn.
    Although I would love to know how to do this, as the data originated in csv format, I converted Sheet2 data into a sed script with a regex oneliner:

    s/foo/John/
    s/bar/Jane/
    s/biz/Mary/
    s/baz/Nancy/

    Then applied the file as a sed script against sheet 1 which worked, importing it in to Excel then allowed me to do the math and reporting in Sheet 1 with the required changes.

    Thanks!

  4. #4
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Large replacement

    could you attach it as a workbook? its hard to tell where the column breaks are from that data.

  5. #5
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Large replacement

    Try VLOOKUP In Sheet1!C1, then copy down

    =IFERROR(VLOOKUP(A1,Sheet2!A:B,2,0),"")

    If a cell is blank means Nothing Found for that row. You can copy >> Paste Values over Col_A
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  6. #6
    Registered User
    Join Date
    02-11-2012
    Location
    London, England
    MS-Off Ver
    2021
    Posts
    41

    Re: Large replacement

    Done, thanks!
    Attached Files Attached Files

  7. #7
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Large replacement

    i woudl recomend the same as Haseeb, and use a vlookup in column C then just paset it over A

    =IFERROR(VLOOKUP(A1,Sheet2!A:B,2,0),"")

  8. #8
    Registered User
    Join Date
    02-11-2012
    Location
    London, England
    MS-Off Ver
    2021
    Posts
    41

    Re: Large replacement

    The vlookup worked perfectly.

    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