+ Reply to Thread
Results 1 to 5 of 5

Trying to VLookup from separate workbook based on a value in a column.

  1. #1
    Registered User
    Join Date
    04-30-2021
    Location
    Glasgow, Scotland
    MS-Off Ver
    Microsoft 365
    Posts
    4

    Trying to VLookup from separate workbook based on a value in a column.

    Hi,

    I don't even know if this is possible, but I'm hoping to simplify a step to avoid having to run several exports from our employee database, and then copy them into one document.
    Essentially we have 15 different "company numbers" and the way our payroll software works, I cannot run one export from all, I need to run each separately and copy them into one documents just now to do the next task, which isn't the end of the world, however If I can set it up so I run the export form payroll directly to a set folder, with a set name, is it possible to pull from several different files, based on data in a set column in the original.

    As an example, If I know employee 123 is in company 2000, can I set it up so that if I enter the company number and employee number it will look in the file named "2000" and pull back the necessary info on employee 123?

    As it stands at the moment, I can get everything I need, but the only way I could get it to work was to have an "export" tab in my main workbook, which I currently have to copy all information from each of the 15 exports and combine them into one worksheet.

    Like I said, I don't even know if this is possible, but any help would be very much appreciated.

    Many Thanks In advance

    Iain

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,872

    Re: Trying to VLookup from separate workbook based on a value in a column.

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    04-30-2021
    Location
    Glasgow, Scotland
    MS-Off Ver
    Microsoft 365
    Posts
    4

    Re: Trying to VLookup from separate workbook based on a value in a column.

    Hi,

    My apologies, I couldn't upload the original documents as there is a lot of sensitive information, so I have mocked up some simple workbooks.
    In theory What I would like to be able to do would be to have all of these saved in one place and if I go into "Main Workbook" and type in the employee number and payroll number it would then pull across their name and department from the correct workbook.

    E.g if the employee is in payroll no 1000 it would pull the name and department from the workbook titled "1000".

    Many Thanks

    Iain
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,546

    Re: Trying to VLookup from separate workbook based on a value in a column.

    I feel that what will be needed is to produce a single lookup table, which could be done using Get & Transform (Power Query).
    The video tutorial linked below is produced by an instructor at Highline College and will hopefully be helpful.
    https://www.youtube.com/watch?v=ldoQws7Zbx8
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,827

    Re: Trying to VLookup from separate workbook based on a value in a column.

    Well, here's an option. (since you're on MS365 you can use XLOOKUP, but earlier versions could use other options)

    On the main workbook, you have the list of EE#'s and their Payroll Number, under "Name" you could enter:

    =XLOOKUP(A2,INDIRECT("["&$B2&".xlsx]Sheet1!A$2:A$5"),INDIRECT("["&$B2&".xlsx]Sheet1!$B$2:$C$5"),"Not found",0)

    This would bring back both the name and the department.
    You could copy this formula down.

    the A2:a5 and b2:c5 would need to be the longest range where compare the lengths of employees on all the payroll numbers and use the one the the highest for your range.
    Attached Files Attached Files

+ 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. [SOLVED] VLOOKUP - Separate Workbook
    By mlbdc2012 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-22-2015, 06:11 PM
  2. Separate one workbook into multiple workbook based on country
    By livelyzd in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-24-2014, 11:34 AM
  3. [SOLVED] Move row based on second column in separate workbook
    By Alimac70 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-03-2013, 07:12 AM
  4. Replies: 4
    Last Post: 02-25-2013, 04:10 PM
  5. Vlookup in tabs of separate workbook
    By happyhorse in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-23-2013, 04:53 PM
  6. [SOLVED] Help: Splitting large workbook into separate workbooks based on R column value.
    By LightingPop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2013, 11:17 AM
  7. Vlookup in separate workbook
    By JimBob2232 in forum Excel General
    Replies: 1
    Last Post: 08-26-2009, 01:55 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