How to Find the Most Common Row and Column Headers in Excel
Question details
The user needs Excel formulas to identify the most frequently occurring row and column headers that correspond to the maximum values across six different data tables.
- Product
- Excel / WPS Spreadsheet
- Device & OS
- not provided
- Scenario
- Analyzing multiple non-contiguous tables to automatically determine which category (header) most frequently holds the maximum values, assuming no ties.
- Observed behavior
- The goal is to automatically extract and aggregate headers associated with the maximum values in each row/column, then calculate the mode of those headers.
Ensure you are using a modern spreadsheet application (such as the latest version of WPS Office or Microsoft Excel 365) that supports dynamic array functions like XLOOKUP, HSTACK, VSTACK, and LET.
Use XLOOKUP Combined with Array Stacking and MODE
This method uses XLOOKUP to find the header for each individual maximum value, then consolidates the results from multiple tables using HSTACK/VSTACK, and finally applies MODE and MATCH to find the most frequent header.
Since text values cannot be evaluated directly by the MODE function, we use the MATCH function to convert the text headers into numeric positions. The INDEX function then converts the most common numeric position back into the actual header text.
The LET function is highly recommended here because it allows you to define the stacked arrays as a single variable named 'range', preventing you from having to type the long HSTACK or VSTACK formulas multiple times.
First, create a helper row or column that identifies the header for the maximum value in each specific dataset. Select the target cell and enter the formula: =XLOOKUP(MAX(B3:I3),B3:I3,$B$2:$I$2). This finds the maximum value in B3:I3 and returns the corresponding header from row 2.
To evaluate the column mode across your six subtotal rows, combine them using HSTACK, transpose them to a column format, and apply MODE and MATCH. Enter the following formula: =LET(range,TRANSPOSE(HSTACK(B13:I13,B27:I27,B41:I41,B55:I55,B69:I69,B83:I83)),INDEX(range,MODE(IFNA(MATCH(range,range,0),""))))
Similarly, to evaluate the most frequent row header across your six row-result ranges, stack them vertically using VSTACK. Enter this formula: =LET(range,VSTACK(J3:J12,J17:J26,J31:J40,J45:J54,J59:J68,J73:J82),INDEX(range,MODE(IFNA(MATCH(range,range,0),""))))
Use WPS Spreadsheet for Advanced Data Consolidation
WPS Spreadsheet fully supports dynamic array functions like XLOOKUP, VSTACK, HSTACK, and LET. This makes it incredibly easy to consolidate data and perform complex analysis across multiple tables without complicated workarounds.
- 1. Open your dataset in WPS Spreadsheet: Launch WPS Office, open Spreadsheet, and load the workbook containing your six tables.
- 2. Apply the XLOOKUP formula: Use =XLOOKUP(MAX(range), range, header_range) in the adjacent cells to retrieve the corresponding headers for the maximum values.
- 3. Consolidate and find the mode: Apply the provided LET and VSTACK/HSTACK formulas in the summary cell to instantly display the most frequent header across all tables.

Frequently Asked Questions
Why does my formula return a #NAME? error?
The #NAME? error typically occurs if your spreadsheet software does not support the dynamic array functions used, such as XLOOKUP, VSTACK, HSTACK, or LET. Ensure you are using the latest version of WPS Office or Microsoft Excel 365.
How does the INDEX and MATCH combination work with MODE?
The MODE function only works with numbers, not text. MATCH is used to return the relative numeric position of each text string in the array. MODE then identifies the most frequently occurring position number, and INDEX retrieves the actual text header located at that position.
What happens if there is a tie for the most common header?
The standard MODE function (and therefore this specific formula combination) will return the first most common value it encounters in the array. If you expect ties and need to see all of them, you would need to modify the formula to use MODE.MULT, which allows multiple results to spill into adjacent cells.




