New: 6 free SQL practice datasets with 300+ questions — try the SQL Compiler →
Excel

Excel Tables, Sorting and Filtering Explained

Excel Tables, sorting and filtering explained: structured references, total rows, SUBTOTAL vs SUM, sort order, AutoFilter, Advanced Filter and duplicates.

Upskly AI Team September 27, 2026 12 min read
Excel Tables, Sorting and Filtering Explained

An Excel Table (select the data and press Ctrl + T) turns a plain range into an object with a name, banded rows, automatic filters, and formulas that grow as you add rows. Sorting puts rows in an order, and filtering temporarily hides the rows that do not match. All three are ordinary features almost everyone uses, and all three have small rules that decide whether a total stays correct as the data changes.

This guide builds a table on one small sales list, shows how its structured references and totals behave as rows are added and filtered, how Excel sorts different kinds of values, and the difference between AutoFilter, Advanced Filter and Remove Duplicates. Every result was produced by running it in Microsoft Excel.

In this guide

The short version

  • Select the data and press Ctrl + T to make a table. Give it a name on the Table Design tab.
  • A formula such as =SUM(Sales[Amount]) updates automatically when rows are added, without editing the formula.
  • The total row uses SUBTOTAL, which ignores filtered-out rows. Plain SUM, ROWS and COUNTA do not.
  • Sorting always keeps a row together: sort by one column and the rest of that row moves with it.

Creating a table and structured references

Select A1:D5 and press Ctrl + T (or Insert, Table). Excel turns the range into a Table, gives it a default name such as Table1, and you can rename it, here to Sales, in the Name Box or on the Table Design tab. A formula written outside the table can refer to a column by name instead of by cell address: =SUM(Sales[Amount]) is easier to read than =SUM($D$2:$D$5), and unlike that fixed range, it follows the table wherever it grows:

A table named Sales; F1 holds =SUM(Sales[Amount])
ABCDEF
1DateRegionProductAmount1700
22024-01-05NorthPen500
32024-01-18SouthBook300
42024-02-02NorthBook700
52024-02-14EastPen200

A table grows with the data

Type a value in the row directly beneath a table and Excel extends the table to include it automatically (this needs the default option Include new rows and columns in the table, under AutoCorrect Options). The SUM formula above needed no editing:

A new row typed at A6:D6; F1 still holds the same formula, now totalling 2,600
ABCDEF
1DateRegionProductAmount2600
22024-01-05NorthPen500
32024-01-18SouthBook300
42024-02-02NorthBook700
52024-02-14EastPen200
62024-02-23SouthPen900

Inside the table, a formula written using the @ symbol refers to the current row. Type =[@Amount]*2 once, in any data row, and Excel fills the whole column for you, and keeps filling it as rows are added:

=[@Amount]*2 typed once in E2

ABCDEF
1DateRegionProductAmountDouble1700
22024-01-05NorthPen5001000
32024-01-18SouthBook300600
42024-02-02NorthBook7001400
52024-02-14EastPen200400

The same formula appears in every row

ABCDEF
1DateRegionProductAmountDouble=SUM(Sales[Amount])
22024-01-05NorthPen500=[@Amount]*2
32024-01-18SouthBook300=[@Amount]*2
42024-02-02NorthBook700=[@Amount]*2
52024-02-14EastPen200=[@Amount]*2

ROWS(TableName) and its variants

A bare table name in a formula, such as Sales, means the data body only, without the header row or the total row. Sales[#All] includes everything, and Sales[Amount] is one column:

F1 =ROWS(Sales), F2 =ROWS(Sales[#All]), F3 =ROWS(Sales[Amount])
ABCDEF
1DateRegionProductAmount4
22024-01-05NorthPen5005
32024-01-18SouthBook3004
42024-02-02NorthBook700
52024-02-14EastPen200

The total row, and SUBTOTAL versus SUM after filtering

Table Design, Total Row adds a row at the bottom with a dropdown per column. Choosing Sum for Amount writes =SUBTOTAL(109,[Amount]), not a plain SUM:

The total row: =SUBTOTAL(109,[Amount])
ABCD
1DateRegionProductAmount
22024-01-05NorthPen500
32024-01-18SouthBook300
42024-02-02NorthBook700
52024-02-14EastPen200
6Total1700

The reason for SUBTOTAL shows up once you filter. Function number 109 means “sum, ignoring rows hidden by a filter (or by hand)”. Filtering the table to Region = North changes the total row, but a plain SUM(Sales[Amount]) or ROWS(Sales) written elsewhere still counts every row, filtered or not:

After filtering to North: the total row versus an ordinary SUM and ROWS elsewhere
ABCDEF
1DateRegionProductAmount1700
22024-01-05NorthPen5004
32024-01-18SouthBook300
42024-02-02NorthBook700
52024-02-14EastPen200
6Total1200

Dynamic arrays do not spill inside a table

A formula that would normally spill into several cells, such as SEQUENCE(3), gives #SPILL! if any of the cells it needs are part of a Table. Here the table was extended to include column E, and SEQUENCE(3) was entered in E2:

E2, a table cell, holds =SEQUENCE(3): #SPILL!, because a table cannot hold a multi-cell spill
ABCDE
1DateRegionProductAmountSeq
22024-01-05NorthPen500#SPILL!
32024-01-18SouthBook300#SPILL!
42024-02-02NorthBook700#SPILL!
52024-02-14EastPen200#SPILL!

The same formula spills without trouble in a cell that is not part of the table, even right next to it:

F1, outside the table, holds the same formula and spills normally
ABCDEF
1DateRegionProductAmount1
22024-01-05NorthPen5002
32024-01-18SouthBook3003
42024-02-02NorthBook700
52024-02-14EastPen200

Convert to Range

Table Design, Convert to Range turns the table back into a plain range, keeping the formatting but removing the filter buttons and the table name. Formulas that used structured references are rewritten to ordinary cell references automatically:

After Convert to Range, F1 still shows 1,700

ABCDEF
1DateRegionProductAmount1700
22024-01-05NorthPen500
32024-01-18SouthBook300
42024-02-02NorthBook700
52024-02-14EastPen200

The formula is rewritten to an ordinary range

ABCDEF
1DateRegionProductAmount=SUM(Sheet1!$D$2:$D$5)
22024-01-05NorthPen500
32024-01-18SouthBook300
42024-02-02NorthBook700
52024-02-14EastPen200

Sorting: what stays together, and the sort order

Sorting a table (or any range with Data, Sort) by one column moves the whole row, so a row’s other values stay matched to it. Sorting the sales table by Amount, descending, keeps each date, region and product with its own amount:

Sorted by Amount, descending: the Book/North row with 700 moved with its own data
ABCD
1DateRegionProductAmount
22024-02-02NorthBook700
32024-01-05NorthPen500
42024-01-18SouthBook300
52024-02-14EastPen200

When a column holds a mix of types, Excel sorts them in a fixed order: numbers, then text, then logical values, then errors, then blank cells last (blanks sort last whichever direction you choose). One column with 5, Pear, TRUE, an error, an empty cell, -3, Apple and FALSE, sorted both ways:

Sorting a mixed column
OrderResult, left to right
Ascending-3, 5, Apple, Pear, FALSE, TRUE, #DIV/0!,
Descending#DIV/0!, TRUE, FALSE, Pear, Apple, 5, -3,

Text that looks like a number but is stored as text sorts alphabetically, not numerically, wherever it appears among other text:

The text values 10, 100, 2 and 9, sorted ascending as text
A
110
2100
32
49

AutoFilter: deleting visible rows, and going stale

AutoFilter (Data, Filter, or the dropdown arrows a Table adds automatically) hides rows instead of removing them. Selecting the filtered rows and deleting them affects only what is visible, which is a safe way to delete a filtered subset. Here a filter to Region = North was applied, the visible rows were selected with Go To Special, Visible Cells Only (Alt + ; is the shortcut) and deleted, and the filter was then cleared to reveal what is left:

After deleting only the visible North rows, the two South rows remain
AB
1RegionAmount
2South2
3South4

A filter does not refresh itself. If you edit a cell so it now matches or no longer matches the criteria, the row’s hidden state does not change until you filter again (the Data, Reapply command, or clicking the dropdown and choosing OK again):

Row 3 hidden: before the edit, right after editing it to match (still hidden), and after reapplying the filter
D
1TRUE
2TRUE
3FALSE

Advanced Filter: AND versus OR

Advanced Filter (Data, Advanced) uses a separate criteria range instead of dropdowns, and it is the tool for combining conditions with OR, which AutoFilter on a single column cannot do across columns. The rule for its criteria range: conditions on the same row are AND, conditions on different rows are OR. To copy the results elsewhere, choose “Copy to another location” (this is Action 2 through COM automation; Action 1 filters the list in place).

Criteria D1:E2 (Region = North AND Amount at least 500, same row): one match
HI
1RegionAmount
2North900
Criteria D1:E1 header with North on row 2 and >=500 on row 3 (different rows): OR, three matches
HI
1RegionAmount
2North100
3South900
4North900

Remove Duplicates

Data, Remove Duplicates deletes every repeat of a row, keeping the first occurrence. Matching is not case sensitive, but it is sensitive to spaces, since a trailing space makes a different piece of text. Column A holds Asha, asha, Ravi, “Asha ” (with a trailing space) and Ravi:

Remove Duplicates on a Name column: asha (different case) was removed, 'Asha ' (a trailing space) was kept
A
1Name
2Asha
3Ravi
4Asha

Run TRIM on the column first if trailing or doubled spaces should count as the same value.

Duplicate and blank headers

Table headers must be unique text. If you turn a range with a duplicate or blank header into a table, Excel renames them for you rather than refusing:

Two columns headed Amount and one blank header, after Ctrl + T
ABC
1AmountAmount2Column3

Common mistakes

Mistake 1: expecting a plain range formula to grow

=SUM($D$2:$D$5) stays fixed at those five rows. Only a Table with a structured reference (Sales[Amount]) grows automatically. A whole-column reference such as SUM(D:D) also grows, at the cost of including anything else typed lower in the column.

Mistake 2: assuming SUM respects a filter

It does not. Use the table’s total row, or SUBTOTAL(109, range) or AGGREGATE(9, 5, range) for a total of only the visible rows.

Mistake 3: forgetting to reapply a filter after editing

A row that now matches the criteria stays hidden, and a row that no longer matches stays visible, until you filter again.

Mistake 4: sorting only part of the data

Selecting one column and sorting it, instead of the whole table, scrambles rows: each cell moves independently of its neighbours. Always select the whole range, or better, sort a proper Table, where Excel sorts full rows automatically.

Cheat sheet

Tables, sorting and filtering cheat sheet
TaskHow
Make a tableselect the range, Ctrl + T
Refer to a table columnTableName[ColumnName]
Refer to the current row[@ColumnName], inside the table
Total that ignores filtered rowsSUBTOTAL(109, range) or the table's total row
Sort a mix of typesnumbers, text, logical, errors, blanks last
Delete only filtered rowsfilter, Alt + ; (visible cells), delete
Refresh a filterData, Reapply
Combine with OR across columnsAdvanced Filter, criteria on different rows
Combine with AND across columnsAdvanced Filter, criteria on the same row
Remove repeated rowsData, Remove Duplicates; keeps the first
Turn a table back into a rangeTable Design, Convert to Range

Try it yourself

Work out each answer first, then open the solution.

1. A table named Sales holds four rows and F1 holds =SUM(Sales[Amount]). You type a new row directly under the table. Does F1 need to be edited?

Show solution

No. The table grows to include the new row automatically, and the formula follows it. Typing 900 in the new row’s Amount cell changes F1 to 2600, as shown earlier.

2. Sort the values 72, Absent, 85, a blank cell and 64 in one column, ascending. What order do you get?

Show solution
A
1Score
264
372
485
5Absent
6

Numbers first, smallest to largest, then the text Absent, and the blank cell last.

3. A table’s total row uses SUBTOTAL(109, [Amount]). You filter the table and then write =SUM(TableName[Amount]) in a cell outside the table. Does it match the total row?

Show solution

No. The total row ignores the hidden rows, but a plain SUM of the same column, written elsewhere, adds every row whether it is filtered out or not.

4. You need every row where Region is North or Amount is at least 500. Which Excel feature can do this in one step, and how do you lay out the criteria?

Show solution

Advanced Filter, with the two conditions on different rows of the criteria range (one row for Region = North, a separate row with only the Amount condition filled in). Conditions on the same row are AND instead.

Frequently asked questions

What is an Excel Table?

A range converted with Ctrl + T into a structured object with a name, filter buttons, banded formatting, and formulas that use column names instead of cell references. It grows automatically as rows are added.

What is a structured reference in Excel?

A formula reference that uses table and column names, such as Sales[Amount] or [@Amount] for the current row, instead of cell addresses like D2:D5.

Why does my table total not match SUM of the same column?

The table’s total row uses SUBTOTAL, which ignores rows hidden by a filter. A plain SUM formula elsewhere still adds every row.

How does Excel sort mixed data types?

Ascending order is numbers, then text, then logical values (FALSE before TRUE), then error values, with blank cells always last. Descending order reverses everything except the blanks, which still sort last.

Why does a filtered row not update automatically when I change its value?

AutoFilter checks the criteria at the moment you apply the filter. An edit afterwards does not re-run the check. Use Data, Reapply, or filter again.

What is the difference between AutoFilter and Advanced Filter?

AutoFilter uses dropdown buttons per column and combines conditions within one column with OR and across columns with AND. Advanced Filter uses a separate criteria range and can combine any conditions with AND (same row) or OR (different rows), and can copy the results elsewhere.

Does Remove Duplicates keep the first or the last copy?

The first one it finds, reading down the column. It ignores upper and lower case but treats a trailing or leading space as a real difference.

Can two columns in a table have the same header?

No, Excel renames the second one automatically, for example turning a second Amount into Amount2, and a blank header into a name such as Column3.

Test yourself

Timed questions on Tables, Sorting and Filtering, with an explanation for every answer.

Take the Quiz
Upskly AI Team
Learning made simple
Scroll to Top