Search code examples
excelexcel-tables

Reference to a column under a variable header of a table


Given a table T and headers H1, H2, H3. I know that we can use T[H1] to refer to the column under the header H1 of the table.

Now, I have a cell A10 containing the header such as H1, H2, or H3. I would like to return the column depending the value of A10, does anyone know how to do that?

I tried T[A10], Excel does not accept that.


Solution

  • =INDIRECT("T["&A10&"]")
    

    More on INDIRECT: indirect