+ Reply to Thread
Results 1 to 11 of 11

VLookup Question - If i update the lookup table i do not want to update old data

  1. #1
    Registered User
    Join Date
    04-17-2010
    Location
    London
    MS-Off Ver
    Mac Excel 2011
    Posts
    6

    VLookup Question - If i update the lookup table i do not want to update old data

    I have a "client sales" sheet and a "products" sheet.
    When a client buys a product i use a drop down box on the "client sales" sheet that looks up products on the "products" sheet and it returns the value of the product.

    After a couple of months the product price may increase, so i have to update the cost of the item on the "products" sheet

    PROBLEM
    All previous sales automatically update after i update the products price on the "products" sheet.
    Is there a way of stopping all old data updating and only new lookups now use the new price?

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

    Re: VLookup Question - If i update the lookup table i do not want to update old data

    Since you already need to enter new values maybe you could enter also date when new value occures.
    That way you would also have history of price changing.
    And you could achieve above criteria by two criteria: date and product.

    If you don't want to do that you would need VBA.

  3. #3
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: VLookup Question - If i update the lookup table i do not want to update old data

    You need to use VBA code to insert formula in client sheet if you don't want the earlier records to be updated with any change in the products sheet in future.
    Please upload a sample workbook exactly same as your original workbook with enough sample data in it along with the formula you are currently using.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  4. #4
    Registered User
    Join Date
    04-17-2010
    Location
    London
    MS-Off Ver
    Mac Excel 2011
    Posts
    6

    Re: VLookup Question - If i update the lookup table i do not want to update old data

    Hi sktneer. I have attached an example of the sheet i am using.

    The client sheet is named as "Joe Bloggs" and the lookup data is on the "Products" sheet.

    1. I select the sheet "Joe Bloggs" and under the chart there is a sales section.
    2. I double click the date column to enter a date.
    3. In the item column there is a drop down to select the item.

    The Vlookup returns the data as expected but if i update the cost/fuel/profit on the product sheet i do not want it to update data already entered into the client sheet.

    Thanks in advance
    Kevin
    Attached Files Attached Files

  5. #5
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: VLookup Question - If i update the lookup table i do not want to update old data

    Please find the attached sheet and follow the instructions in red text i.e. start entering sales figure in row 23. First enter date in U23, then select item from V23 drop down list, as soon as you select the item from the drop down list, the remaining cells in that row will be automatically filled with the correct value.
    Now go to the products sheet and make a change in the cost for the item you just entered in the row 23 of Client Name sheet.
    Now come back to Client Name sheet and enter a new record for the same item in row 24 and see if the new row of records contains the updated cost for that item and the row 23 still contains the old cost for that item.

    For detail see the attached sheet. The VBA code in on Client Name sheet. To view the code right click on Client Name sheet -->View code.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-17-2010
    Location
    London
    MS-Off Ver
    Mac Excel 2011
    Posts
    6

    Re: VLookup Question - If i update the lookup table i do not want to update old data

    Thats cool sktneer.
    Thanks for the speedy response.

    Just playing with the sheet now and trying to work out your vba

    I did get it to work incorrectly but not sure what i did lol

  7. #7
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: VLookup Question - If i update the lookup table i do not want to update old data

    Take your own time to give it a try and make sure that you are getting the correct values.

  8. #8
    Registered User
    Join Date
    04-17-2010
    Location
    London
    MS-Off Ver
    Mac Excel 2011
    Posts
    6

    Re: VLookup Question - If i update the lookup table i do not want to update old data

    Hello, i have re-created the problem i mentioned above.

    I have attached another file that has two sales in the client sheet.
    If i edit the last sale or add another sale, all works ok
    If i try to edit the top item (not the last one) in the list, the code doesn't work.

    Regards
    Kevin

    PS did you have a datepicker on the sheet?
    Only other bit i didn't understand was "target" references
    Attached Files Attached Files
    Last edited by mrabattoir; 04-27-2014 at 01:58 PM.

  9. #9
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: VLookup Question - If i update the lookup table i do not want to update old data

    Earlier the code was designed to update the value of last row entered. It was assumed that you will not edit previous values once entered in the sales table.
    But if you need to edit the previous records as well, please find the attached sheet to see if this works as per your requirement now.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    04-17-2010
    Location
    London
    MS-Off Ver
    Mac Excel 2011
    Posts
    6

    Re: VLookup Question - If i update the lookup table i do not want to update old data

    Quote Originally Posted by sktneer View Post
    Earlier the code was designed to update the value of last row entered. It was assumed that you will not edit previous values once entered in the sales table.
    But if you need to edit the previous records as well, please find the attached sheet to see if this works as per your requirement now.
    Perfect. You sir are a genius

    Thank you.

  11. #11
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: VLookup Question - If i update the lookup table i do not want to update old data

    Glad to help you. Thanks for the kind words.
    If that takes care of your question, please mark your thread as solved by selecting Thread Tools --> Mark thread as solved.

+ 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. Replies: 6
    Last Post: 02-23-2024, 02:11 PM
  2. Automatically update existing data using a Update command button
    By 9999335 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-23-2012, 09:46 PM
  3. Excel Pivot Table Update Question
    By jklee1010 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-10-2010, 12:07 PM
  4. how to update data on sheet1 and have it auto update on sheet2
    By Tommy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-11-2005, 06:43 PM
  5. [SOLVED] In Excel 2003 how do you get a table to update based on lookup cr.
    By cliveshelton in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-20-2005, 12:06 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