Search code examples
excelvba

Finding matching column header in excel


In Excel (2021) I have a header row for 11 columns. In my data rows, in column 1 through 10, I have numbers. I want column 11 to be the column header for the column with the lowest value. How do I do this...?

More detailed example: Assume my headers are simply the letters A through K (first 11 columns). In row 2, I have the values in the first 10 cells sequentially 1 through 10. I need to determine the column header of the cell with the lowest value...
So for row 2 (my data row), the first column (A2) has the lowest value (1). I need the column header of that column (which is 'A') to be put in cell in the last column of that row. I am at a loss as to how to do this.


Solution

  • You can use index/match:

    =INDEX(A$1:I$1,1,MATCH(MIN(A2:I2),A2:I2,0))