+ Reply to Thread
Results 1 to 5 of 5

Application.WorksheetFunction.VLookup

  1. #1
    Registered User
    Join Date
    05-07-2014
    Location
    Waterloo, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    3

    Application.WorksheetFunction.VLookup

    Hi all,

    I am using Excel 2003...

    We are a small manufacturing company.
    All our raw materials have inventory tags with a serial number generated by our "Q:\RM Inventory\RM Inventory Tag.xls]" worksheet. It has approx. 5000 rows. The serial numbers are sequential and are in column A.
    All our work in Process and Finished Goods have an inventory tag with a serial number generated by our "Q:\WIP & FG Inventory\WIP & FG Inventory Tag.xls]" worksheet. It has approx. 55000 rows. The serial numbers are sequential and are in column A. (side note: I recognize I will soon need to start a new tab in the WIP & Finished Goods worksheet so I don't run out of rows.)

    I am building an inventory taking worksheet where I would enter a serial number in a cell (named SearchTagNumber) and it would bring back the 13 columns of data for the specific tag number entered. The columns hold either text, numbers or dates. Normally, I would use VLookup formulas like this to return the data based on the tag serial number:

    Raw Material
    =VLOOKUP(SearchTagNumber,Q:\RM Inventory\[RM Inventory Tag.xls]RM Master List'!$A$5:$M$5000,1,FALSE)
    =VLOOKUP(SearchTagNumber,Q:\RM Inventory\[RM Inventory Tag.xls]RM Master List'!$A$5:$M$5000,2,FALSE)
    etc.

    WIP & FG
    =VLOOKUP(SearchTagNumber,Q:\WIP & FG Inventory\[WIP & FG Inventory Tag.xls]WIP & FG Master List'!$A$5:$M$60000,1,FALSE)
    =VLOOKUP(SearchTagNumber,Q:\WIP & FG Inventory\[WIP & FG Inventory Tag.xls]WIP & FG Master List'!$A$5:$M$60000,2,FALSE)
    etc.
    The problem is with the WIP & FG formulas. I need 13 VLookup formulas looking at 60,000 rows in the WIP & FG Inventory Tag worksheet. I get the error message "Excel cannot complete this task with available resources".

    To resolve this, I would like to use the VBA VLookup function to lookup and return the data from the closed worksheets without the load of all the formulas. I would bring the data back to my inventory taking worksheet to A10:M10 where I would review the data, correct it if necessary, then append it to the next row in the inventory listing on the next tab. For the life of me, I just can not get the Application.WorksheetFunction.VLookup working. Once I get the data back to my inventory taking worksheet, I'm probably fine to figure out how to append the 13 cells to the next open row on either the RM or WIP & FG tabs I would be populating as I take inventory.

    Any help and guidance would be most appreciated.

    With kind regards,

    David

  2. #2
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: Application.WorksheetFunction.VLookup

    Hello David, and welcome to the forums

    This code may help, it is one variation that I have used in VBA successfully, obviously you need to put your values in.

    Please Login or Register  to view this content.
    I admit to not studying your request with a microscope so I may have missed something however if you are using a macro to "do stuff" then perhaps you could consider using the Filter options. If you recorded a macro where you apply a filter to Col A and then look at the code you should see how to "generalise" the code to return just the one row you need that matches you "search tag"

    PS. At the bottom of the thread you will find a panel where links to "similar threads" that often can provide valuable insights into how others have solved their problem
    Last edited by jmac1947; 05-07-2014 at 07:25 PM. Reason: added in comments about similar threads

    Cheers

    Jmac1947

    1. Please consider clicking on the * Add Reputation if you think this post has helped you
    2. Mark your thread as SOLVED when question is resolved

  3. #3
    Registered User
    Join Date
    05-07-2014
    Location
    Waterloo, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Application.WorksheetFunction.VLookup

    Hi jmac1947,

    Thank you kindly for your reply. I'm relatively new at this but if I understand it correctly, I think your code would still result in a series of (macro-generated) VLookup formulas in my inventory taking worksheet which would then have the same resource issues as if I entered the formulas directly into cells. If I've misunderstood and it actually returns the cell values, then it might be perfect.

    Another key thing to note is that the Master List worksheets are not open on my computer, only my inventory taking worksheet.

    I need to find a way to use a VBA function to, using the serial # I've entered, identify the matching row in the 60,000 line worksheet then bring back the values in the 13 columns of that row. I'd also like to do this in a way that doesn't open then close the Master List worksheets in order to get the data.

    Apologies for the lengthy initial post! Hopefully this clarifies somewhat...

    Thanks again,

    David

  4. #4
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: Application.WorksheetFunction.VLookup

    Hello David,
    thanks for the reply, and yes my original code suggestion would do as you suggest.

    OK, so onto Plan B then (which is possibly outside my experience in handling multiple workbooks) in the event that no-one else chimes in with a solution I think something like the following is what we need to do.

    first get the tag you are interested in, easy enough to achieve with the msgbox statement (or use the contents of a cell you have just entered the tag into perhaps).
    I will assume for the time being that the master files are in a static path with a static name. I will also assume that the "tag" value in each of the masters is in Col A and that the value is unique within each workbook.

    Second, we need to (for each master list) filter the master worksheet to show only the row that matches the tag you entered. (no matches would be an error to trap, multiple which you say should not occur can be handled by either treating as an error or by simply taking the first row returned).

    After the filter has been applied you simply copy the row (which will have the 13 cols you are interested in) back to the original workbook where you do your usual "magic happens here stuff"

    Easy enough for me to say, and if it was different sheets in a single workbook it would be easy to actually do.

    I will have to spend a bit of research and playing time to do the multiple workbook aspects, particularly the filter bit.

    Will continue to play over the weekend and hopefully work out something for you, any other readers who have better "multiple workbook processing skills" (and that will not take much) feel free to chime in

    Jmac

  5. #5
    Registered User
    Join Date
    05-07-2014
    Location
    Waterloo, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Application.WorksheetFunction.VLookup

    Hi jmac19,

    You're right, it would be easier if all the data was in the same workbook on different sheets. It's unfortunately not possible to do that. I'm also hoping to not actually open the external workbooks to retrieve the data as staff go in and out of it all day long adding in and tagging our production as it happens. This is why I was hoping to do it without opening the file. I'm hearing that VLookup in VBA only works with open workbooks...

    Thank you so much for helping me. I really appreciate it. Hopefully we can find a method that will work!

    With kind regards,

    David

+ 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. Problem with Application.WorksheetFunction.VLookup
    By RKJunior in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-01-2013, 01:52 PM
  2. Application, WorksheetFunction or both?
    By Benni in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-04-2012, 08:59 PM
  3. Application.WorksheetFunction
    By roger09 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-29-2011, 09:07 AM
  4. Application.WorksheetFunction.VLookup / Runtime 9
    By Tino XXL in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-25-2011, 04:29 AM
  5. [SOLVED] application.worksheetfunction
    By Ozgur Pars in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-18-2006, 03:15 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