How to Use VLOOKUP or VBA to Match Data Between Excel Workbooks
Question details
The user needs to populate a column in one workbook by matching a key value with corresponding data from a different workbook.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Looking up and matching corresponding values (like a Team or Managed By Group) from an external spreadsheet that frequently expands and contracts as new entries are added.
- Observed behavior
- The user wants to identify the best method to retrieve external data reliably, evaluating whether to use VLOOKUP, Excel Tables, or automated VBA scripts.
Ensure both the target workbook and the source workbook are saved in accessible locations. It is recommended to keep both files open side-by-side while writing your formulas to allow Excel to generate the external cell references automatically.
Use VLOOKUP with External Workbook References
The VLOOKUP function is the most straightforward method to match and retrieve data from a separate workbook by looking for a shared identifier.
When using VLOOKUP across different files, the formula must contain the exact name of the source workbook enclosed in brackets. The lookup column must also be the very first column in your selected data range.
Open the workbook where you want to populate the data, as well as the source workbook containing the reference information.
In your target cell, type `=VLOOKUP(` and select the cell containing your lookup value (e.g., the DNS host name).
Type a comma, then switch to the window of your source workbook. Highlight the columns containing your data. Excel will automatically write the external file path and sheet name into the formula.
Type a comma, enter the column index number containing the value you want to return, type another comma, and enter `FALSE` (or `0`) to force an exact match. Press Enter.

Convert Data Ranges to Excel Tables for Dynamic Scaling
If your dataset grows or shrinks regularly, converting your ranges into Excel Tables prevents you from having to constantly update the VLOOKUP range references.
Automate Cross-Workbook Lookups Using VBA
For massive datasets where VLOOKUP calculation times become slow, or to hide the external fetching process, you can use VBA to retrieve data.
Match Data Easily Across Workbooks with WPS Spreadsheet
WPS Spreadsheet provides powerful data handling capabilities, fully supporting cross-workbook VLOOKUP formulas, dynamic arrays, and VBA macros to help you match and analyze external data seamlessly.
- 1. Launch WPS Spreadsheet: Open WPS Office and start the Spreadsheet application.
- 2. Open Your Workbooks: Open both the target file where you need the data and the source file using the intuitive tabbed interface.
- 3. Enter the Formula: In the target cell, begin typing `=VLOOKUP(`, select your lookup value, and simply switch to the other file tab to select the reference data.
- 4. Complete and Drag: Finish the formula with the column index and match type, press Enter, and drag the fill handle down to populate the rest of the column.

Frequently Asked Questions
Do I have to keep the second workbook open for VLOOKUP to work?
No, standard VLOOKUP formulas can retrieve data from closed workbooks. When the source workbook is closed, Excel automatically updates the formula to show the full file path. However, keeping it open while building the formula makes selecting ranges much easier.
Why is my cross-workbook VLOOKUP returning an #N/A error?
An #N/A error indicates that the exact lookup value cannot be found in the first column of your source range. Check for trailing spaces, formatting differences (like text vs. numbers), or ensure you selected the correct starting column in your external file.
Can I use XLOOKUP instead of VLOOKUP for different workbooks?
Yes, XLOOKUP is an excellent, more flexible alternative. It allows you to search in any column (not just the first one) and returns matching values from any other column, working perfectly across separate external workbooks.
Why does my workbook prompt me to 'Update Links' when I open it?
When you use VLOOKUP to reference an external workbook, you create a data link. The application asks for permission to check the source file and update any values that might have changed since you last opened the target file.




