0

I am working with a collection of tables (in different workbooks) that share the same structure. These are the job registers for a given year, and the primary key for each item is the year (2018) plus the 4 digit 'row number' (1, 2, 3...), so we have IDs that look like '20180001', '20170191', etc.

My issue is that I need to be able to perform a vlookup on these values without knowing which sheet the number will be in, meaning they all need to be on the same sheet. I have experimented with copy pasting the IDs all into a single table, and then doing another vlookup there to pull the data into that table so that I could reference it as the master copy, but this doesn't allow expansion at all, and must be manually handled at all times. I've tried some stuff with PowerQuery, but I can't figure out how to append multiple queries together.

Here is an example of what the tables might look like.

This is an example of what the outcome might look like.

Note how table 1 with only 3 columns has an extra column without data in it, so that it matches the size of table 2.

Each table is nearly identical in structure, meaning they have mostly the same columns (each year, we might add another column or two to the current register), with the only difference being the tuples.

How might I be able to append these tables together dynamically so that it can refresh whenever needed and keep accurate data on hand?

6
  • I'm afraid your question is unclear. Can you edit it to explain what you are trying to do?
    – Blackwood
    Commented Aug 24, 2018 at 4:16
  • 1
    Try to use IF() chain - check VLOOKUP from one book, if success - use, if error - check from another book: IF(ISERROR(get from book1), IF(ISERROR(get from book2), ... , (get from book2)), (get from book1)).
    – Akina
    Commented Aug 24, 2018 at 4:47
  • Added an example @Blackwood, I hope that clarifies Commented Aug 24, 2018 at 5:06
  • @Akina I don't want to use this method since it means that it is not easily expandable. With your solution, I would have to edit all of the formulas to include the new years register so that they can be referenced, whereas with the table appending solution I want would only require I edit the query that pulls in that data. Since it would all be on one table, all of the formulas would already work Commented Aug 24, 2018 at 5:06
  • it is not easily expandable If so create UDF with a RANGE parameter contained a list of worbooks/years which the function will try to obtain data from. Unlike VLOOKUP it can determine the year and obtain the data from one proper book instead of scanning all of them. Moreover it can cache last row read from a separate book into a static variable and return a data without reading external workbook if an index is equal to stored in. To expand you will simply add one more row to a workbooks list.
    – Akina
    Commented Aug 24, 2018 at 5:36

1 Answer 1

-1

Do you want to get the result as below:

enter image description here

4
  • That looks exactly right. I'll verify it works tomorrow morning when I get to work. Not sure why someone down voted you when it is clearly the solution Commented Aug 27, 2018 at 5:20
  • Maybe I just uploaded a gif but not explained steps clearly. -.-
    – Lee
    Commented Aug 27, 2018 at 6:49
  • Well either way, thank you for the solution. Maybe you could split up the steps or write some stuff so that it's a more cohesive solution Commented Aug 27, 2018 at 22:27
  • I will do this next time.
    – Lee
    Commented Aug 28, 2018 at 0:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .