Lesson 6 of 8 · see all lessons
  1. Formulas from zero

    1. 1. Excel basics: cells, ranges and your first SUM formula
    2. 2. Relative vs absolute references in Excel ($A$1)
    3. 3. How to use the IF function in Excel (and nested IF)
  2. Answer questions with conditions and lookups

    1. 4. SUMIFS and COUNTIFS in Excel: add and count with conditions
    2. 5. How to use XLOOKUP in Excel (and VLOOKUP when you have to)
  3. Organize and summarize the month

    1. 6. How to sort, filter and make a table in Excel
    2. 7. How to make a pivot table in Excel
    3. 8. Excel practice: build a monthly sales report

10 min

How to sort, filter and make a table in Excel

Sort rows without scrambling them, filter to the rows you need, and turn your data into an Excel table with Ctrl+T so formulas grow with it.

By the end of this lesson you can

  • Sort by one or two columns and keep every row together
  • Filter by two columns and read what SUM does with hidden rows
  • Turn a range into a named table and use a structured reference
  • Use a total row that follows your filter

From earlier lessons · 1 of 2

What does XLOOKUP return when it finds no match and has no if_not_found?

Pick one answer.

From earlier lessons · 2 of 2

In =XLOOKUP(C2,$S$2:$S$9,$T$2:$T$9), which part returns the cost?

Pick one answer.

Thirty rows fit on one screen, but the manager still asks: what was our biggest line? Show me just Ben's food. Scrolling and squinting isn't an answer. Sorting and filtering are.

Take a guess

You sort the sheet by Total, largest to smallest. Which order line lands in row 2?

No pressure. Guess now, and the lesson will show you if you were right.

Sort without scrambling rows

Click one cell in the Total column, such as H5. Don't select the whole column. On the Data tab, choose Sort Largest to Smallest. Excel finds the edges of your data and moves whole rows. The empty column O is the edge, so your report panel stays where it is.

If you do select just one column, Excel warns you. Choose Expand the selection. Continue with the current selection sorts that column alone, and each Total ends up beside the wrong item.

[22]

text
Click H5 > Data > Sort Largest to Smallest
Expected rows 2 to 4: Sandwich 45.50 (28 Mar, Ana), Latte 42.00 (7 Mar, Ana), Sandwich 39.00 (14 Mar, Chloe). Q6 still shows 649.00: totals don't care about order.

Predict, then reveal

Before sorting, =XLOOKUP("Latte",C2:C31,A2:A31) returned 2026-03-02. What does it return after this sort?

[6]

To sort by two columns, open Data > Sort, sort by Category (A to Z), then choose Add Level and sort by Total (Largest to Smallest). Rows group by category, biggest first inside each group. Before you go on, press Ctrl+Z once for each sort you did, until row 2 is the 2 March latte again. Later lessons point at rows by number, such as E2.

[22]

You sort by Category A to Z, then by Total largest to smallest. What is in row 2?

Pick one answer.

Filter: show only the rows you need

The manager asks: show me Ben's food sales. Click any cell in the data and choose Data > Filter. Arrows appear in the header row. Open Category, untick (Select All), tick Food, and choose OK. Then do the same in Staff for Ben. Filters are additive: each one narrows what the last one left.

[21]

text
Category = Food, then Staff = Ben
Expected: 4 rows. Muffin 18.00 (7 Mar), Sandwich 26.00 (10 Mar), Croissant 19.25 (13 Mar), Croissant 24.75 (22 Mar). Together: 88.00.

With that filter on, what does =SUM(H2:H31) in Q6 show?

Pick one answer.

[4]

Make it a table with Ctrl+T

Turn the filters off: click any cell in the data and choose Data > Filter again. Click any cell in the data and press Ctrl+T (Cmd+T on a Mac). Tick My table has headers and choose OK. The range A1:N31 becomes an Excel table. On the Table Design tab (the Table tab on a Mac), click in the Table Name box, type Sales and press Enter.

Now you can write structured references: Sales[Total] means every data cell in the Total column. It grows when the table grows.

[3][23][24][31]

What Ctrl+T adds to a plain rangePlain range A1:N31Table named SalesFilter arrows in headersBanded rowsCalculated columnsTotal row (SUBTOTAL)Formulas can say Sales[Total]instead of H2:H31Ignores rows hidden by afilter
excel
=SUM(Sales[Total])
Expected: 649.00. Test it: in A32 to G32 type 2026-03-31, Tue, Latte, Coffee, 4, 3.50, Ana, one per cell. If H32 stays empty, type =E32*F32. The table grows: Sales[Total] gives 663.00, but =SUM(H2:H31) stays 649.00. Then right-click row number 32 and choose Delete.

[23][32]

Tick Total Row on the Table Design tab. In the new bottom row, open the drop-down under Total and pick Sum. Excel writes a SUBTOTAL formula there, and SUBTOTAL skips rows a filter hides.

[24][33]

In the table, you filter Category to Food. What does the total row under Total show?

Pick one answer.

[24]

Match

Match each job to where you do it in Excel.

Pick an item on the left, then its match on the right.

In Google Sheets: sort with Data > Sort range, and filter with Data > Create a filter. A filter there is visible to everyone who can open the file. Sheets has tables too: Format > Convert to table.

[19][20]

FlashcardsIndex cardsFlashcards ⚡

Card 1 of 15

Worth keeping

  1. Click one cell before sorting so whole rows move; if Excel warns, expand the selection.
  2. Filters hide rows; SUM still adds them, but a table's total row doesn't.
  3. Ctrl+T makes a named table, and Sales[Total] grows with new rows.
  4. Sorting changes which match is first, never the totals.

Filters answer one question at a time: Ben's food, then Chloe's coffee, then the next. The manager wants every staff member against every category, all at once. Writing nine SUMIFS would work. A pivot table builds the whole grid in about five clicks.

Embed this practice on your site

Free for classrooms, blogs and study groups. Paste this into any page that accepts HTML.

Report a copyright problem with this lesson

Sources for this lesson (12)

Each fact in the lesson is marked with the number of the page it comes from.

  1. [3]Microsoft Support: Keyboard shortcuts in Excel
  2. [4]Microsoft Support: SUM function
  3. [6]Microsoft Support: XLOOKUP function
  4. [19]Google Docs Editors Help: Sort & filter your data
  5. [20]Google Docs Editors Help: Use tables in Google Sheets
  6. [21]Microsoft Support: Filter data in a range or table
  7. [22]Microsoft Support: Sort data in a range or table
  8. [23]Microsoft Support: Using structured references with Excel tables
  9. [24]Microsoft Support: Overview of Excel tables
  10. [31]Microsoft Support: Rename an Excel table
  11. [32]Microsoft Support: Resize a table by adding or removing rows and columns in Excel
  12. [33]Microsoft Support: Total the data in an Excel table