Skip to content

Write formulas with structured references

Excel tables9 minPremium

Builds on Add a total row and calculated columns to a table, Total by several conditions with SUMIFS and Count what matches with COUNTIF and COUNTIFS.

A sales analyst in Montreal sends a weekly summary built on a table of orders. She had totaled the Amount column as D2:D250, and every order after row 250 went missing from the report.

How it works

A structured reference names part of a table instead of its cells. It grows and shrinks with the table, so a total never stops at an old last row.

RowAB
1ReferenceWhat it covers
2Sales[Amount]the data in the Amount column, without the heading or the total row
3[@Amount]the Amount in the formula's own row
4Sales[[#Totals],[Amount]]the Amount cell of the total row
5Sales[#All]the whole table, headings and total row included

Outside the table, start with the table's name. Inside it, Excel leaves the name out: [Amount] is the column and [@Amount] the same row. You rarely type one in full. Type the table name and an opening bracket and Excel lists the columns, or select a column's cells while you write a formula and Excel writes the reference for you. Every function that takes a range takes one, so =SUMIFS(Sales[Amount],Sales[Region],G2) totals one region and reads almost as a sentence. Filled down, a column reference such as Sales[Region] stays as it is, so it needs no $ signs; filled to the right, it moves to the next column.

Example

The analyst's table is named Orders.

=SUM(Orders[Amount])
Adds every amount in the Amount column of the Orders table, however many rows the table has.

  1. Step 1: Sales[Amount] is the Amount data, C2:C7, without the heading or the total.
  2. Step 2: [@Amount] in a formula on row 4 means C4, the Amount of the same row.
  3. Step 3: Sales[#All] is everything, from the headings to the total row.
Each structured reference covers its own part of the table. When an order is added, Sales[Amount] and Sales[#All] take in the new row by themselves.

Common mistakes

  • =SUM(D2:D250) keeps adding the same cells when the table grows past row 250. =SUM(Sales[Amount]) follows the table.
  • Sales[@Amount] in a row the table doesn't reach, such as under the total row, shows #VALUE!, because that row has no Amount. For the whole column, use Sales[Amount].
  • A reference to the same row needs a second pair of brackets when the column name has a space: [@[Unit price]].
  • A formula that mixes a table column with a plain range, such as =SUMIFS(Sales[Amount],B2:B250,G2), shows #VALUE! once the two stop being the same size. Use the table's columns throughout.

In short

  • Table[Column] is a column's data, and it grows with the table.
  • [@Column] is the value in the formula's own row.
  • Outside the table, start with the table's name, as in =SUM(Sales[Amount]).
  • Use one table's columns throughout a formula, not a mix of columns and plain ranges.

Practice

Premium

5 exercises: 3 table tasks, 1 formula and 1 quiz question.

Practice is part of Premium

Every lesson is free to read, and you can practice the free lessons without an account. This lesson's exercises are part of Premium, which you add to a free account.