+ Reply to Thread
Results 1 to 16 of 16

finding and replacing multiple values

  1. #1
    Registered User
    Join Date
    06-14-2014
    Posts
    17

    finding and replacing multiple values

    Hi there,

    I'm currently doing a project which requires me to find and replace a large number of values.

    ie. Column A Row 1 = 80099, Column A Row 2 = 554441, Column A Row 3 = Z5478, CAR4 = B89877 etc...


    I need to replace these numbers with meaningful values and I have a reference table to tell me what these codes mean ie. 80099 = apple juice, 554441 = orange puree, Z5478 = pumpkin soup, B89877 = banana smoothie. The reference table is in a separate excel spreadsheet and is tabulated in two columns ie. Column A = "the code", Column B = "the value".

    There are like 1000+ codes I need to find and replace which I know is going to kill me if I did it manually. How do I find and replace all the values?

    Thank you....

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: finding and replacing multiple values

    Separate sheet in the same workbook (one xlsx file), or on a separate workbook (two xlsx files). can you post an example sheet(s)?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: finding and replacing multiple values

    c2
    Please Login or Register  to view this content.
    and then copy => paste special => values from column C to column A.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: finding and replacing multiple values

    Hi,

    Just use a VLOOKUP()
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Registered User
    Join Date
    06-14-2014
    Posts
    17

    Re: finding and replacing multiple values

    Quote Originally Posted by Glenn Kennedy View Post
    Separate sheet in the same workbook (one xlsx file), or on a separate workbook (two xlsx files). can you post an example sheet(s)?
    Hi there Glen,

    The reference table is on a separate workbook (another xlsx file).

    I don't know how to use the Vlookup function

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: finding and replacing multiple values

    You probably would be better off with an INDEX:MATCH. See the example sheets attached here.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-14-2014
    Posts
    17

    Re: finding and replacing multiple values

    Quote Originally Posted by Glenn Kennedy View Post
    You probably would be better off with an INDEX:MATCH. See the example sheets attached here.
    Hi Glen, thanks for the solution. It looks simple enough. But before I apply the formula to 80,000 values, I have one more question. What happens if there are duplicate values on the source xlsx? ie. 1234 = banana, 1234 = banana (yellow), 1234 = BANANA

  8. #8
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: finding and replacing multiple values

    Post an small excel file, without confidential information.

    Place the other data on sheet2 (just for this example).

    Please also add the duplicated as you mentioned also in your file.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: finding and replacing multiple values

    As it stands, Excel will not be able to know which subset to use, so it will use the first once it finds, going down the column

  10. #10
    Registered User
    Join Date
    06-14-2014
    Posts
    17

    Re: finding and replacing multiple values

    Post an small excel file, without confidential information.

    Place the other data on sheet2 (just for this example).

    Please also add the duplicated as you mentioned also in your file.

    Here you go.
    Attached Files Attached Files

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: finding and replacing multiple values

    I can't think of any obvious way round this. Excel will not know from the string A4897 whether you want oranges or mandarins.

    It's not much use as a code!! Are there any other columns in your real data that could help make the codes unique to a single descriptor?

  12. #12
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: finding and replacing multiple values

    re read your question

    1) is this column CAR ?

    Please Login or Register  to view this content.
    2) you post another workbook (file)

    I asked you for a worksheet (e.g. sheet 2)

    3) when it should be banana (and when shouldu it be banana yellow) with the same number.

    You better change the nummer of banana (yellow) in e.g. 32133
    Last edited by oeldere; 06-14-2014 at 12:24 PM. Reason: changed workbook in worksheet

  13. #13
    Registered User
    Join Date
    06-14-2014
    Posts
    17

    Re: finding and replacing multiple values

    Yeah... the reference codes I have are very confusing but I've managed to solve the problem (kinda). Thanks everybody!

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: finding and replacing multiple values

    If you have reached a solution, you should post it, so that others might learn what to do in a similar situation.

    Can you also mark the thread as solved and (preferably) say thanks to all that helped by clicking the Add Reputation button at the foot of their post(s)?

  15. #15
    Registered User
    Join Date
    06-14-2014
    Posts
    17

    Re: finding and replacing multiple values

    Oh sure,

    I went with what you suggested (ie. the INDEX:MATCH method) and it worked beautifully, except that the duplicate values in the reference table was causing havoc. When faced with a duplicate, Excel will go with the first value it encounters and ignores the other duplicates. There's no way around this except to fix the reference table. Good thing a colleague emailed me an updated reference table with less duplicate values and that sorta fixed the issue.


  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: finding and replacing multiple values

    Fix the codes. The best possible solution!

+ 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. Find and replacing multiple values VBA
    By Hutton34 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-25-2012, 06:38 AM
  2. Replies: 1
    Last Post: 06-30-2012, 01:45 PM
  3. Macro for find and replacing values in multiple CSVs
    By kali237 in forum Excel General
    Replies: 4
    Last Post: 10-09-2011, 08:10 AM
  4. Finding/Replacing Currency Values in Excel
    By jeremay in forum Excel General
    Replies: 2
    Last Post: 05-22-2008, 04:01 PM
  5. Replacing values on multiple sheets using a macro
    By psoftguy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-19-2005, 06:05 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