+ Reply to Thread
Results 1 to 8 of 8

VLOOKUP type of Macro to search and find through an entire spreadsheet (workbook)

  1. #1
    Registered User
    Join Date
    07-31-2014
    Location
    Home
    MS-Off Ver
    Office 2010
    Posts
    21

    VLOOKUP type of Macro to search and find through an entire spreadsheet (workbook)

    Hi,

    I need help with the following:

    Using the Employee ID, I would need to find:
    1. In which tabs is the employee listed
    2. The Pay rate from each tab

    The spreadsheet layout is consistent so the field headers are the same across all the tabs. Every month the number of tabs can vary.

    Thank you very much in advanced,
    DPP
    Attached Files Attached Files

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VLOOKUP type of Macro to search and find through an entire spreadsheet (workbook)

    You haven't really made clear how you want to use this information... But have a look at this, which will generate a couple of arrays, contianing the sheets where the Employee reference is found, and the rates in each sheet.
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    07-31-2014
    Location
    Home
    MS-Off Ver
    Office 2010
    Posts
    21

    Re: VLOOKUP type of Macro to search and find through an entire spreadsheet (workbook)

    Hi Olly,

    I have never used arrays. I am not sure how to get the output.

    In the example, I am looking up the employees on "sheet1".

    Thank you for your willingness to help me,
    DPP

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VLOOKUP type of Macro to search and find through an entire spreadsheet (workbook)

    For the example workbook you attached, what does your OUTPUT look like? What do you want to end up with?

  5. #5
    Registered User
    Join Date
    07-31-2014
    Location
    Home
    MS-Off Ver
    Office 2010
    Posts
    21

    Re: VLOOKUP type of Macro to search and find through an entire spreadsheet (workbook)

    Hi Olly,

    I apologize for not explaining.

    I am attaching the spreadsheet with the desired output on sheet1 highlighted in yellow.

    Thank you!
    DPP
    Attached Files Attached Files

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VLOOKUP type of Macro to search and find through an entire spreadsheet (workbook)

    Okay - I've changed the code to a function, so you can use it on the worksheet:
    Please Login or Register  to view this content.
    The function requires three arguments.
    1. Employee - the employee string to be found in all worksheets
    2. OutputType - 1 for Sheet Name, 2 for Pay Rate
    3. ExcludeCurrent (optional) - false or omitted to include all worksheets, true to exclude the current worksheet.


    Use as:
    F
    G
    1
    Tabs Pay Rate
    2
    =employeedetails($A2,1,TRUE) =employeedetails($A2,2,TRUE)
    3
    =employeedetails($A3,1,TRUE) =employeedetails($A3,2,TRUE)
    4
    =employeedetails($A4,1,TRUE) =employeedetails($A4,2,TRUE)
    5
    =employeedetails($A5,1,TRUE) =employeedetails($A5,2,TRUE)



    Which returns:
    F
    G
    1
    Tabs Pay Rate
    2
    Sheet2,Sheet4 20,5
    3
    4
    Sheet3 10
    5
    Sheet2,Sheet3,Sheet4 30,15,15

  7. #7
    Registered User
    Join Date
    07-31-2014
    Location
    Home
    MS-Off Ver
    Office 2010
    Posts
    21

    Re: VLOOKUP type of Macro to search and find through an entire spreadsheet (workbook)

    Olly, Thank you very much!!!!! This is GREAT!

    DPP

  8. #8
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VLOOKUP type of Macro to search and find through an entire spreadsheet (workbook)

    Happy to help

    You can click "Add Reputation" on posts you found useful

+ 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 to Find and Replace for entire workbook
    By HeatherAngelo in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-13-2014, 03:23 PM
  2. Altering VBA find function to search entire workbook
    By zaclim78 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-20-2012, 03:24 PM
  3. Replies: 0
    Last Post: 02-14-2012, 12:34 PM
  4. Replies: 7
    Last Post: 07-28-2011, 10:05 AM
  5. VLookup function to search an entire workbook
    By liseladele in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-09-2005, 08:40 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