Function Problems

How to Copy a Dynamic VLOOKUP Formula Across Multiple Excel Columns

Khadija KhanKhadija Khan Nov 11, 2026 870 views

Question details

The user needs to retrieve values from multiple PivotTable columns by copying a single formula across and down, automatically matching the destination column headers to avoid entering column index numbers manually.

How to Copy a Dynamic VLOOKUP Formula Across Multiple Excel Columns
Product
Excel
Device & OS
not provided
Scenario
Extracting data from a PivotTable into a new table where the source columns need to be dynamically identified based on the destination header names.
Observed behavior
Instead of typing manual column indexes for each column, the user wants a dynamic formula that automatically adapts when dragged across the row and down the columns.
Before you start

Ensure that your destination table headers closely match your source data headers, as dynamic lookups rely on these names to correctly identify the required column indexes.

Solution 1Recommended

Use VLOOKUP Combined with the MATCH Function

Nesting the MATCH function inside a VLOOKUP formula allows Excel to dynamically calculate the correct column index number based on the current column header.

By using MATCH for the 'col_index_num' argument in VLOOKUP, the formula searches for the header name in the source data's header row. This approach makes your formula completely dynamic, allowing you to drag it across dozens of columns without changing numbers manually.

1
Select the destination cell

Click on the first cell in your new table where you want to retrieve the data (e.g., cell B2).

2
Enter the dynamic VLOOKUP formula

Type the formula: =IFERROR(VLOOKUP($A2,$F$17:$I$24,MATCH(TRUE,ISNUMBER(SEARCH(B$1,$G$16:$I$16)),0)+1,FALSE),""). Adjust the cell ranges to match your specific dataset.

3
Confirm the formula

Press Enter. If you are using an older version of Excel (prior to Microsoft 365 or Excel 2021), confirm the formula as an array by pressing Ctrl+Shift+Enter.

4
Copy across and down

Click and hold the fill handle (the small square at the bottom-right of the selected cell) and drag it across your columns, then drag it down to fill the rest of the rows.

Use VLOOKUP Combined with the MATCH Function
Proper Reference Locking: Notice the use of mixed references like $A2 (locks the column for the lookup value) and B$1 (locks the row for the header value). This is crucial for the formula to work when dragged.
Powerful Spreadsheet Capabilities

Master Dynamic Formulas with WPS Spreadsheet

WPS Office provides advanced formula capabilities, fully supporting complex nested functions like VLOOKUP, INDEX, MATCH, and XLOOKUP. You can easily apply these dynamic lookups to streamline your data retrieval without manual effort.

  1. 1. Open your data file in WPS Spreadsheet: Launch WPS Office, open your Excel spreadsheet, and locate the destination table.
  2. 2. Input the dynamic formula: Type your preferred dynamic lookup formula, such as VLOOKUP combined with MATCH, into the first target cell.
  3. 3. Lock references accurately: Use the F4 key to toggle absolute and mixed references (e.g., $A2 and B$1) quickly.
  4. 4. Drag to fill: Use the intuitive fill handle to drag the formula across multiple columns and down the rows instantly.
Fully compatible with Microsoft Excel formulas, functions, and file formats (.xlsx)Supports dynamic arrays and advanced lookup functions nativelyLightweight software that ensures fast processing of large datasets and PivotTablesFree to use for everyday spreadsheet and data analysis tasks
microsoft office alternative - wps office

Frequently Asked Questions

Why is my dynamic VLOOKUP formula returning a #N/A error?

This error typically occurs if the lookup value or the destination header does not perfectly match the source data. Ensure there are no trailing spaces in your headers and that your ranges are correctly locked with absolute references (like $F$17:$I$24).

Can I use XLOOKUP instead of VLOOKUP and MATCH?

Yes. If you are using a modern spreadsheet software like WPS Office or newer versions of Excel, you can nest an XLOOKUP inside another XLOOKUP to perform a two-way lookup, effectively replacing VLOOKUP and MATCH.

How do I lock cell references when dragging formulas?

Use the dollar sign ($) to lock specific rows or columns. For a dynamic VLOOKUP, lock the column of your lookup ID (e.g., $A2) so it stays on column A when dragged right, and lock the row of your header (e.g., B$1) so it stays on row 1 when dragged down.

Does this formula work if the source PivotTable changes in size?

If the PivotTable adds new rows or columns that extend beyond the locked ranges (e.g., $F$17:$I$24) defined in your formula, the new data won't be captured. You will need to update the formula to encompass the new dimensions or use dynamic named ranges.