How to Return the Header for the Highest Average or Total in Excel
Question details
The user wants to use a formula to return the text from the top row (header) of a column that contains the highest calculated average or total within a given range.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Analyzing multiple columns of numeric data to dynamically identify and label the top-performing category.
- Observed behavior
- The user needs a dynamic formula that continuously displays the correct column header from row 1 associated with the highest column average or total, updating instantly when source numbers change.
Ensure your dataset is organized with clear text headers in the first row and purely numerical data in the rows beneath, and remove any merged cells that might disrupt the column arrays.
Use an Advanced One-Step Formula (INDEX, LET, and BYCOL)
Best for modern spreadsheet versions, this calculates the totals or averages dynamically in memory without requiring an extra helper row.
This approach utilizes dynamic array functions. It calculates the sum or average for each column, identifies the maximum value, and retrieves the corresponding header—all within a single cell.
Click on the cell where you want the highest average's column header to be displayed (e.g., cell B21).
Type the formula: =INDEX(A1:J1,LET(b,BYCOL(A2:J16,LAMBDA(a,AVERAGE(a))),MATCH(MAX(b),b,0)))
Press Enter. The cell will now automatically calculate the averages for columns A through J, find the maximum, and output the text from row 1 of that specific column.

Use a Helper Row with INDEX and MATCH
A traditional, highly compatible method that references a row where your totals or averages are already calculated.
Use a Helper Row with XLOOKUP
A simplified, modern alternative to INDEX/MATCH when referencing existing calculated data.
Perform Complex Data Analysis Seamlessly with WPS Spreadsheet
WPS Spreadsheet provides powerful data processing capabilities, fully supporting advanced lookup functions and dynamic arrays to help you find maximum averages and retrieve column headers with ease.
- 1. Open WPS Spreadsheet: Launch WPS Office and open your workbook containing the data range.
- 2. Select the Target Cell: Click on the cell where you want the highest average's column header to be displayed.
- 3. Input the Formula: Type the provided INDEX/MATCH or dynamic array formula and press Enter.
- 4. Update Dynamically: Modify your source data; WPS Spreadsheet will instantly recalculate and update the header automatically.

Frequently Asked Questions
How do I return the header for the lowest average instead?
You can use the exact same formulas but replace the MAX() function with the MIN() function. This will prompt the formula to look for the smallest value in the calculated arrays or helper rows.
Why is my formula returning an #N/A error?
This usually happens if the lookup value isn't found in the lookup range, or if your header range (e.g., A1:J1) and data range (e.g., A17:J17) are not the same width. Ensure the number of columns in both ranges match exactly.
Do I have to use a helper row to find the maximum value?
No. By using the dynamic array formula with LET and BYCOL (as shown in the recommended solution), you can calculate the column totals in memory without taking up extra rows in your worksheet.
Does XLOOKUP work in older versions of Excel?
XLOOKUP is only available in Microsoft 365, Excel 2021, and modern versions of WPS Office. If you are using an older version like Excel 2016, you must use the INDEX and MATCH combination instead.




