A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
MAXIFS returns #VALUE! when the ranges used do not have the same size and shape. To get the header of the maximum value in the row for NR 2008, use a combination of INDEX/MATCH (or XLOOKUP) instead of MAXIFS.
Assuming this layout:
- NR in A2:A10
- Headers (IT, Material, Mechanical, …) in B1:E1
- Data in B2:E10
- The NR to search (2008) in A13
Use this formula in C13:
=INDEX($B$1:$E$1,
MATCH(MAX(INDEX($B$2:$E$10,MATCH($A13,$A$2:$A$10,0),0)),
INDEX($B$2:$E$10,MATCH($A13,$A$2:$A$10,0),0),
0))
Explanation (non-array in modern Excel):
-
MATCH($A13,$A$2:$A$10,0)finds the row where NR = 2008. -
INDEX($B$2:$E$10, that_row, 0)returns the entire row of values for 2008. -
MAX(...)gets the maximum value in that row. - The outer
MATCHfinds the position of that max within the row. -
INDEX($B$1:$E$1, ...)returns the corresponding column header (e.g., "Material").
If MAXIFS is used anywhere in this scenario, ensure that max_range and each criteria_rangeN are exactly the same size and shape; otherwise Excel will return #VALUE!.
References: