+ Reply to Thread
Results 1 to 17 of 17

Vlookup data and compare variances

  1. #1
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Vlookup data and compare variances

    Hi

    I have begun the macro coding for a stock report. The macro report has on sheet 3 the minimum stock numbers for each item which has a 5 digit stock code which I was hoping to vlookup in a weekly report to give the variances - which will in turn give an indication of which items need restocked/replenished etc and displayed on sheet 2.

    Here is my code so far - can someone please please help me with how to use the v lookup on a loop ? or is there an easier way.

    Please Login or Register  to view this content.

    The export file will be a weekly report that will be used to compare against the permanent file held on sheet 3 in "PAULS STOCK WORKSHEET.xlsm" I only want those stock items which are negative reported in sheet 2

    PAULS STOCK WORKSHEET.xlsmXL_Export.xlsb

    Many thanks in advance

  2. #2
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: Vlookup data and compare variances

    Please can someone help?

    I need to the lines of stock data numbers appear from the export report appear in sheet 3 of the stock report(being what the stock should be at a minimum) - if it does I need the variance i.e. current stock less minimum stock numbers and reported in red if negative.

    eg Pauls Stock report details 1 safety helmet but weekly report states 26 so need to see -25

    Thanks a lot for any help or direction

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Vlookup data and compare variances

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: Vlookup data and compare variances

    This is perfect - thank you v much for responding. How could I add in a column for current stock (from the stock report) and the minimum stock required (in the pauls stock report sheet 3) ? The variance generated would then be the difference between these two as you have correctly calculated.

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Vlookup data and compare variances

    You're welcome. Glad to help out. Delete this line just before your End Sub - Columns("F:G").delete. I didn't know you wanted to keep them.

  6. #6
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: Vlookup data and compare variances

    PAULS STOCK WORKSHEETorig.xlsmJohn - thanks again for your time. I modified it slightly but when I delete out the columns("F:G").delete it doesn't populate it and its gotta be what I have done. I attach the code so u can see ? and how I need the spreadsheet to be ?



    Also the sheets have been names XL_Export.xlsb is this going to matter if they are named differently each week - this is the only report name that would change regularly.


    John - sincere thanks for your help



    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Vlookup data and compare variances

    I didn't try to re-incorporate it into your code. But see if this helps?

    Please Login or Register  to view this content.
    Also, the Export file how is it renamed every week? Do you use a standard naming convention for this?

  8. #8
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: Vlookup data and compare variances

    Hi John

    Absolutely spot on - not too bothered about the file name I will get around it. One thing that seem to be an issue - it only reports the data in sheet 2 for 14 rows of data but there is loads more. Would I need to sort the data on both worksheets - could it be the vlookup has stopped working because the data is not in order ?

    thanks
    Leanne

  9. #9
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Vlookup data and compare variances

    That shouldn't be an issue, but try this instead.

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: Vlookup data and compare variances

    Hello - I changed the code to the above but no difference - still only 14 rows of data ? any ideas

  11. #11
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Vlookup data and compare variances

    Can you attach a sample, where this is happening?

  12. #12
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: Vlookup data and compare variances

    hi sure - here is the output and the code is within the macro tabPAULS STOCK WORKSHEETorig.xlsm

  13. #13
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Vlookup data and compare variances

    Quote Originally Posted by leanne2011 View Post
    hi sure - here is the output and the code is within the macro tabAttachment 304208
    It looks like it should be 14? Or do you want it the other way around? If you autofilter on Column G custom < 1. You can see which items should be carried over too Sheet2.

  14. #14
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: Vlookup data and compare variances

    Ah thats why - I dont need less than one. finally then (i promise and so sorry to keep on) if I take out the bit <1 how then do I take care of the bits where there are no values and zero data - it doesnt produce a variance

    Thanks John

  15. #15
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Vlookup data and compare variances

    I think we have a communication problem. Please explain what items you want to copy over to Sheet2 and how we will determine that.

  16. #16
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: Vlookup data and compare variances

    John - it all works fine and my mistake. This is all solved - many thanks.

    Kind regards
    Leanne

  17. #17
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Vlookup data and compare variances

    You're welcome Leanne. Glad to hear it works for you, and thanks for the feedback.

+ 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. VLOOKUP to compare data
    By sathish.potlakonda in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-13-2013, 10:07 PM
  2. [SOLVED] Sort and compare multiple database outputs identifying variances.
    By Dilbet in forum Excel General
    Replies: 4
    Last Post: 01-31-2013, 04:14 AM
  3. Handling variances in user-entered text data
    By mwwoodm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-01-2011, 11:42 AM
  4. Using Vlookup to compare and validate data
    By Big Jones in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 PM
  5. Using Vlookup to compare and validate data
    By Big Jones in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM

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