HLOOKUP is the lesser known companion to VLOOKUP, the Excel workhorse formula. You can put HLOOKUP to good use when you have two Excel files with some but not all columns in common, and you want to merge them.
In this example we're using this formula:
. . . to pull data from Sheet2 onto Sheet1. Sheet1 has the following headings:
. . . and Sheet2 has these headings:
We want to add in the data from Sheet2 to the columns that are in common between the 2. So here:
. . . refers to the first heading on Sheet1, and then searches the first 100 columns a match ($1:$100), and returns the entry from the first row (ROW(A1)). When this formula is pulled down and to the right it both collects the entries under the first heading from Sheet2 and also searches for the subsequent headings on the second worksheet.
To find the columns from Sheet2 which are not used on Sheet1 you can use another HLOOKUP formula at the bottom of Sheet1:
. . . then simply transpose the data to filter it down to the columns missing from sheet1:
. . . then re-transpose the data again so just the missing columns (in this example BB and E) are added to the first worksheet.