Function Problems

Create Copyable Excel Metrics Formulas with Defined Names

Chanuka GeekiyanageChanuka Geekiyanage Dec 2, 2026 869 views

Question details

Create a metrics formula that selects the appropriate survey field when copied across a table.

Create Copyable Excel Metrics Formulas with Defined Names
Product
Microsoft Excel
Device & OS
not provided
Scenario
A metrics table has age groups in rows and survey field names, such as Cookies, in column headers.
Observed behavior
A formula using a fixed defined name continues to refer to the same field when copied across columns.
Before you start

Check that the metrics headers match the corresponding data headers or defined names, and identify the age-group column. The examples below count numeric values of 1; adjust the ranges and criteria for your workbook.

Solution 1Recommended

Select data columns dynamically with INDEX and MATCH

Use matching column headers to select the survey field without relying on a different defined name for each formula.

This method selects columns from the Data sheet by their headers; it does not dynamically select Excel defined names. The example assumes age groups are in Data column C and data occupies rows 2 through 1000.

1
Set up matching headers

On the metrics sheet, enter a survey field header such as Cookies in B1 and an age group in A2. Make sure the field header exactly matches a header in Data!A1:Z1.

2
Enter the formula

In B2, enter =SUMIFS(INDEX(Data!$A$2:$Z$1000,0,MATCH(B$1,Data!$A$1:$Z$1,0)),Data!$C$2:$C$1000,$A2,INDEX(Data!$A$2:$Z$1000,0,MATCH(B$1,Data!$A$1:$Z$1,0)),1).

3
Copy across and down

Drag the fill handle from B2 across the metric columns and down the age-group rows. B$1 changes across columns, while $A2 changes down rows.

4
Adjust the ranges

Edit both INDEX data ranges and the age-group range if your data extends beyond row 1000 or uses different columns. Keep the ranges the same height.

Select data columns dynamically with INDEX and MATCH
What the formula counts: SUMIFS adds the numeric 1 values in the selected field for the specified age group. Text values and other response codes may require different criteria or a different formula.
Create metrics in WPS Spreadsheet

Build Copyable Metrics Formulas in WPS Spreadsheet

Use INDEX, MATCH, and SUMIFS in WPS Spreadsheet to select a survey field by its header and copy the formula across your metrics table.

  1. 1. Open the workbook: Open your Excel workbook in WPS Spreadsheet and select the metrics sheet.
  2. 2. Check the labels: Enter a metric header in B1 that matches a header on the Data sheet, and enter an age group in A2.
  3. 3. Add the formula: In B2, enter =SUMIFS(INDEX(Data!$A$2:$Z$1000,0,MATCH(B$1,Data!$A$1:$Z$1,0)),Data!$C$2:$C$1000,$A2,INDEX(Data!$A$2:$Z$1000,0,MATCH(B$1,Data!$A$1:$Z$1,0)),1). Adjust the ranges to fit your data.
  4. 4. Fill the table: Drag B2's fill handle across and down, then check the results against the source data.
Select metric columns dynamically using matching headersCopy formulas across fields and down age groupsOpen and edit Microsoft Excel XLSX filesWork in a familiar spreadsheet interface
microsoft office alternative - wps office

Frequently Asked Questions

Why does my defined name stay the same when I copy a formula?

A formula containing a fixed name such as Cookies continues to refer to that name when copied. Use INDEX and MATCH to select a column by its header, or INDIRECT to turn a header into a defined-name reference.

Why does MATCH return an error for my metric header?

Check that B1 matches a header in Data!A1:Z1 and that the MATCH range covers the relevant column. The final argument 0 requires an exact match.

How do I check or change a defined name in Excel?

Go to Formulas > Name Manager, select the name, and inspect its Refers to range and scope. Make sure the metric and age ranges cover the same rows.

Can I use these formulas in Excel 2016?

Yes. Excel 2016 supports SUMIFS, INDEX, MATCH, and INDIRECT. Check that the ranges and defined names match your workbook before copying the formula.

What do the dollar signs in B$1 and $A2 do?

B$1 keeps the header row fixed while allowing the column to change across the table. $A2 keeps the age-group column fixed while allowing the row to change as you copy down.