Function Problems

How to Select a Monthly Summary Column with XLOOKUP in Excel

Elise WilliamsElise Williams Nov 13, 2026 869 views

Question details

The user needs a formula that uses a month entered in a cell to dynamically select the correct monthly cost column while applying additional row criteria.

How to Select a Monthly Summary Column with XLOOKUP in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A user has monthly costs stored in separate columns and wants to pull the matching value by changing only the month cell and criteria.
Observed behavior
The formula should return the monthly summary value automatically instead of requiring manual column reference changes.
Before you start

Confirm that the month cell entry matches the month headers exactly and that the data range includes both the month header row and all monthly cost columns. Also make sure your spreadsheet version supports XLOOKUP before creating the formula.

Solution 1Recommended

Use a Nested XLOOKUP to Dynamically Select a Monthly Summary Column

Best when you need one matching value and want the month cell to drive the returned column automatically.

The inner XLOOKUP uses the month cell to return the entire data column for that month. The outer XLOOKUP then applies the row criteria to that returned column, so the formula updates whenever the month or criteria change.

1
Select the output cell

Click the cell where you want the monthly summary result to appear, then click the formula bar to start editing.

2
Enter the nested XLOOKUP formula

Type =XLOOKUP(F2&F3,dept&code,XLOOKUP(F1,months,data)) and replace F1 with the month cell, months with the month header range, data with the monthly data columns, and F2 and F3 with your criteria cells and ranges.

3
Press Enter and test

Press Enter to calculate the result, then change the month cell or criteria cells to verify that the returned value updates automatically.

Use a Nested XLOOKUP to Dynamically Select a Monthly Summary Column
Formula returns the matching monthly summary: Nested XLOOKUP first selects the correct monthly column and then returns the value for the matching row criteria.

Use WPS Spreadsheets to Build a Dynamic Monthly Summary Lookup

WPS Spreadsheets supports the same nested XLOOKUP and FILTER formulas, letting you automatically select a monthly cost column by a cell value while keeping full compatibility with Excel workbooks.

  1. 1. Open your workbook in WPS Spreadsheets: Launch WPS Spreadsheets and open the Excel workbook that contains your monthly cost columns and criteria.
  2. 2. Select the result cell: Click the cell where the monthly summary should appear, then click the formula bar.
  3. 3. Enter the dynamic lookup formula: Type =XLOOKUP(F2&F3,dept&code,XLOOKUP(F1,months,data)) and replace the month cell, header range, data range, and criteria references with your worksheet ranges.
  4. 4. Press Enter and verify: Press Enter, then update the month cell or criteria to confirm that the returned value changes automatically.
Nested XLOOKUP makes monthly summary reports update automaticallyFamiliar formula syntax and spreadsheet interfaceFull compatibility with Microsoft Excel XLSX filesFree, lightweight, and easy to use without changing your workflow
microsoft office alternative - wps office

Frequently Asked Questions

How does the inner XLOOKUP select the correct monthly column?

The inner XLOOKUP looks up the month cell value in the month header range and returns the entire matching column from the data range. That returned column is then used as the return array for the outer XLOOKUP.

Can I add more than two row criteria to this formula?

Yes. Concatenate additional criteria cells and ranges, such as F2&F3&F4 and dept&code&area. If the conditions become complex, a FILTER formula with multiplication may be clearer.

Why does my nested XLOOKUP return #N/A?

Check that the month cell exactly matches a header in the month range, that criteria cells match values in the lookup ranges, and that all referenced ranges have the same dimensions.

Does this work when the month cell contains a date?

It works only if the month cell and month headers use the same data type and display format. If headers are text such as January, use text in the month cell; if they are dates, match the date values.

How can I return multiple rows for a selected month?

Use FILTER with XLOOKUP, such as =FILTER(XLOOKUP(F1,months,data),(dept=F2)*(code=F3)), to return all rows that satisfy the criteria for the selected month.