Google-sheets – Getting the column header if the row value is the greatest of the entire row

google sheetsgoogle-sheets-queryworksheet-function

I think that the best way to describe what I want is with a image

enter image description here

Check the image. Each row will have a description (Of a feature of the programming language, for example) each language will have a rate. The languages with the biggest rates will have their names shown in the "Winner" column.

I want the formula to use in the C column.
It have to respect 2 things:

  1. I can add more languages (More columns)
  2. I can add more descriptions (More rows)

The best I could formulate was this:

  • =FILTER(C1,C2=max(C2:2)) That will, in the first row, return only Ruby if Ruby has the max value. I couldn't make it generic to repeat for every column.
  • =FILTER(C1:Z1,C2:Z2=max(C2:Z2)) Based on the above but it returns an error

Best Answer

FILTER is the way to go, but you need to combine it with ARRAYFORMULA:

=ARRAYFORMULA(JOIN(",",FILTER(C$1:Z$1,C2:Z2=max(C2:Z2))))

(the $ signs make it easy to autofill the formula)

enter image description here