Skip to content

tableColumn

Reference an entire column from a table.

tableColumn(
    tableName,
    columnName
)

Arguments

tableName

The table name, or a formula that returns a table name. If you name a table directly, put it in quotation marks, e.g. "Rates".

You can also use a function that ensures that the table exists in the output and returns a table name, like table, excelTable, csvToTable, sqlToTable, or featherToTable.

columnName
The column name, or a formula that returns a column name.

Return value

tableColumn returns the data cells from the requested table column as a one-dimensional range or vector. It does not return the header row, and it does not look up a specific row by itself.

Use this when a formula needs to work with a whole external or user-provided table column, for example with MATCH, INDEX, SUM, or similar formula functions.

This function is for data table columns, not the columns of tables in the projection node results.

Examples

Reuse a row index

Use MATCH once to find the row in a lookup column, then reuse that row index with INDEX for several columns:

TableName = "Table1"
RowLookup = TEXT(Date, "yyyy-mm-dd")
RowIndex = MATCH(RowLookup, tableColumn(TableName, "Lookup"), 0)

Var1 = INDEX(tableColumn(TableName, "Var1"), RowIndex)
Var2 = INDEX(tableColumn(TableName, "Var2"), RowIndex)
Var3 = INDEX(tableColumn(TableName, "Var3"), RowIndex)

Aggregate a table column

Because tableColumn returns a whole column, it can also be used with aggregate functions:

TotalPremium = SUM(tableColumn(TableName, "Premium"))
MaxRate = MAX(tableColumn(TableName, "Rate"))

Table loading

tableName follows the same table-name conventions as functions such as TableLookup and tableSumIfs.

You can assign the result of a table-loading function to a variable:

TableName = csvToTable("rates.csv")
RowIndex = MATCH(RowLookup, tableColumn(TableName, "Lookup"), 0)
Rate = INDEX(tableColumn(TableName, "Rate"), RowIndex)

You can also pass a table-loading function directly:

RowIndex = MATCH(RowLookup, tableColumn(csvToTable("rates.csv"), "Lookup"), 0)
Rate = INDEX(tableColumn(csvToTable("rates.csv"), "Rate"), RowIndex)