Function Problems

How to Use VLOOKUP or VBA to Match Data Between Excel Workbooks

Camila MilosovichCamila Milosovich Oct 29, 2026 872 views

Question details

The user needs to populate a column in one workbook by matching a key value with corresponding data from a different workbook.

How to Use VLOOKUP or VBA to Match Data Between Excel Workbooks
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.
Before you start

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.

Solution 1Recommended

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.

1
Open Both Workbooks

Open the workbook where you want to populate the data, as well as the source workbook containing the reference information.

2
Initiate the Formula

In your target cell, type `=VLOOKUP(` and select the cell containing your lookup value (e.g., the DNS host name).

3
Select the External Data Range

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.

4
Specify the Return Column and Match Type

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.

Use VLOOKUP with External Workbook References
File Reference Tip: If you close the source workbook, Excel will automatically update the formula to display the full absolute file path on your hard drive. This is normal and ensures the data remains linked.
Advanced Data Processing

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. 1. Launch WPS Spreadsheet: Open WPS Office and start the Spreadsheet application.
  2. 2. Open Your Workbooks: Open both the target file where you need the data and the source file using the intuitive tabbed interface.
  3. 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. 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.
100% compatible with Microsoft Excel file formats (.xlsx, .xls, .csv).Native support for advanced functions like VLOOKUP, HLOOKUP, XLOOKUP, and MATCH.Familiar user interface makes writing complex external reference formulas simple.Advanced versions support VBA and macros for workflow automation.
microsoft office alternative - wps office

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.