Skip to content

Sorting and Filtering Spreadsheet Data

20 min read Training Guide

Sort a list by one or more columns without scrambling its rows, filter it down to the records you need, and total only the rows that are showing.

Table of contents

Sorting puts a list in order: oldest invoice first, biggest order first, last names A to Z. Filtering hides the rows you do not need right now, such as everything except open work orders for one building. Both are quick, and both can quietly wreck a list when the data is not set up for them. The worst case is a sort that reorders one column and leaves the others behind, so every name ends up next to someone else's phone number. This guide shows how to do both safely in Excel and Google Sheets.

What You Will Be Able to Do

  • Get a list ready so a sort keeps every row together.
  • Sort by one column, and by several columns in a set order.
  • Filter by values, by conditions and by color, then clear the filter.
  • Total or count only the rows a filter leaves showing.
  • Use the SORT and FILTER functions where you need a live, separate result.

Get the List Ready First

Run this check before every sort:

  1. One header row. Each column has a name in row 1, and there is only one header row.
  2. No blank rows or columns inside the data. Both programs treat a blank row as the end of the list.
  3. No merged cells in the data. Excel will not sort a range with merged cells of different sizes.
  4. Unhide everything. In Excel, hidden rows are not moved when you sort, so they end up out of place.
  5. Give yourself a way back. If the original order matters, such as the order entries came in, add a column named "Row" with 1, 2, 3 down the list before you sort. Sorting by that column later restores the original order. Undo (Ctrl+Z) also works right after a sort.

Sort by One Column

Here is a short list of open invoices:

A B C
1 Vendor Due Date Amount
2 Brightline Supply 4/10/2026 312.40
3 Acme Janitorial 3/28/2026 89.00
4 Coastal Print 4/02/2026 1,045.75
5 Acme Janitorial 4/15/2026 210.00

To see what is due first, sort by Due Date, oldest to newest.

Excel: Click any one cell in the Due Date column. Do not select the whole column. Choose Data > Sort A to Z, which sorts dates oldest to newest. On the Home tab's Sort & Filter menu, the wording matches the data: Smallest to Largest for numbers, Oldest to Newest for dates. Excel finds the edges of the list, keeps row 1 as the header and moves whole rows. The order becomes Acme (3/28), Coastal (4/02), Brightline (4/10), Acme (4/15).

Google Sheets: Select the whole list, A1:C5. Choose Data > Sort range > Advanced range sorting options. Check Data has header row, pick Due Date, choose A to Z (oldest first for dates), and click Sort.

You can also right-click a column letter in Google Sheets and choose Sort sheet A to Z. That sorts every row on the sheet by that column. Freeze the header row first (View > Freeze > 1 row), so the header stays at the top instead of being sorted into the data.

Warning: Never sort a single selected column on its own. In Excel, if you select only one column, a Sort Warning box appears. Choose Expand the selection. In Google Sheets, Sort range sorts exactly the cells you selected and does not warn you, so one selected column gets reordered while its neighbors stay put. If it happens, press Ctrl+Z right away.

Sort by Several Columns

A multi-level sort orders by the first column, then breaks ties with the second. To group the invoices by vendor and show each vendor's oldest invoice first:

Excel: Click in the list, choose Data > Sort, and check My data has headers. Set Sort by to Vendor, A to Z. Click Add Level, then set Then by to Due Date, Oldest to Newest. Click OK.

Google Sheets: Select the list, choose Data > Sort range > Advanced range sorting options, and check Data has header row. Sort by Vendor, A to Z. Click Add another sort column, choose Due Date, A to Z, and click Sort.

Result: Acme (3/28), Acme (4/15), Brightline (4/10), Coastal (4/02).

When A to Z Is the Wrong Order

Some columns have a working order that is not alphabetical. Sorting priorities High, Medium and Low from A to Z gives High, Low, Medium. Months typed as text sort April, August, December.

  • Excel: In the Sort box, set Order to Custom List. Pick an existing list such as the months or days of the week, or type your own, such as High, Medium, Low.
  • Google Sheets: There is no custom list. Add a helper column that turns the priority into a number, such as =IF(D2="High",1,IF(D2="Medium",2,3)), and sort by that.

Why a Sort Comes Out Wrong

What you see Likely cause Fix
100 sorts before 20 The numbers are stored as text Convert them to real numbers
1/10/2026 sorts before 1/2/2026 The dates are stored as text Convert them to real dates
Rows below a point never move A blank row cut the list in two Delete the blank row and sort again
"Smith" and " Smith" end up apart A leading space Trim the spaces
Names no longer match phone numbers Only one column was sorted Undo now, or restore from version history

In Excel, when a column mixes real numbers with numbers stored as text, a box may ask how to sort "anything that looks like a number". Choosing to sort it as a number gets you through today, but the real fix is converting the text. Blank cells sort to the bottom.

Filter a List

A filter hides the rows that do not match and leaves the rest of the data alone. Nothing is deleted.

Turn filters on.

  • Excel: Click in the list and choose Data > Filter (Ctrl+Shift+L). A drop-down arrow appears in each header cell.
  • Google Sheets: Click in the list and choose Data > Create a filter. A filter button appears in each header cell.

Pick what to show. Click the arrow or button in the column you want to filter.

Filter type Excel Google Sheets
Pick from a list Check the values to keep, or use the search box Filter by values
A rule, like "greater than 500" Number Filters, Text Filters or Date Filters Filter by condition
Cell or text color Filter by Color Filter by color

Examples with the invoice list:

  • All Acme invoices: In the Vendor column, clear every box except Acme Janitorial.
  • Invoices over $300: In Excel, choose Number Filters > Greater Than and type 300. In Google Sheets, choose Filter by condition > Greater than and type 300.
  • Due before April 5: In Excel, choose Date Filters > Before and type 4/5/2026. Date Filters also offers Between, This Month and Next Month. In Google Sheets, choose Filter by condition > Date is before, pick exact date, and type 4/5/2026.

Filters on two columns work together. A row shows only if it passes both.

Know when a filter is on. In Excel, the row numbers of a filtered list turn blue and skip numbers, and the arrow in a filtered column changes to a funnel icon. In Google Sheets, the filter button in a filtered column also changes to a funnel. If a list looks short, look for these signs before you report a count.

Clear it. In Excel, choose Data > Clear to show every row while leaving the arrows in place, or Data > Filter to turn filtering off. In Google Sheets, choose Data > Remove filter.

Filters on a Shared Sheet

In Google Sheets, a filter changes the view for everyone who has the file open. To filter just for yourself, use a filter view: choose Data > Create filter view, set it up and save it. Other people keep seeing the full list, and you can switch back to your view later. In Excel, files stored in OneDrive or SharePoint offer a similar option under View > Sheet View.

Total Only the Rows That Show

SUM adds every row, whether a filter hides it or not. To total only the rows still showing, use SUBTOTAL. It works the same way in both programs.

A B C
1 Vendor Status Amount
2 Acme Janitorial Paid 89.00
3 Brightline Supply Open 312.40
4 Acme Janitorial Open 210.00
5 Coastal Print Paid 1,045.75

Put the totals below the list, with a blank row between, so the filter does not hide them.

  • =SUM(C2:C5) returns 1,657.15 whether a filter is on or off.
  • =SUBTOTAL(9,C2:C5) also returns 1,657.15 with no filter. Filter Status to Open, and it returns 522.40.
  • =SUBTOTAL(3,A2:A5) counts the showing rows that are not empty. With the Open filter, it returns 2.

The first number picks the math. 9 is sum, 1 is average and 3 is a count of filled cells. Rows hidden by a filter are always left out. Rows you hide by hand with Hide Rows still count under 9, but not under 109. Use 109 if people hide rows by hand.

Copying, Pasting and Deleting in a Filtered List

Filtered lists hide rows in the middle of the range you select, so treat them with care.

  • Copying. In Excel, copying a filtered range copies only the rows that are showing. In Google Sheets, check the pasted result. Compare its row count with what you expected before you use it.
  • Pasting. Do not paste a block of values into a filtered list. The values can land in hidden rows. Remove the filter first, or paste into a new sheet.
  • Deleting. Before you delete rows from a filtered list, make sure the filter shows only the rows you mean to delete. Clear the filter afterward and confirm the rest of the data is still there.

SORT and FILTER Functions

The SORT and FILTER functions build a sorted or filtered copy of a list in another spot and keep it updated as the source list changes. The original list stays as it was. Both programs have them, but the arguments differ. Excel has them in Microsoft 365, Excel 2021 and later, and Excel for the web, not in Excel 2019 or earlier.

Task Excel Google Sheets
Sort by column 3, largest first =SORT(A2:C20,3,-1) =SORT(A2:C20,3,FALSE)
Rows where column B is "Open" =FILTER(A2:C20,B2:B20="Open") Same formula
Two tests, both true =FILTER(A2:C20,(B2:B20="Open")*(C2:C20>300)) =FILTER(A2:C20,B2:B20="Open",C2:C20>300)
Nothing matches #CALC!, unless you add a third argument such as "None" #N/A

The result fills as many cells as it needs, so leave empty space below and to the right of the formula. If something is in the way, Excel shows #SPILL! and Google Sheets shows #REF!.

Common Mistakes

Mistake What it costs
Sorting one selected column Every row's data is scrambled
A blank row inside the list Part of the list is not sorted or filtered
Reporting a count from a filtered list without noticing the filter Numbers that leave out records
Using SUM on a filtered list A total that includes the hidden rows
Pasting into a filtered range Values written into rows you cannot see
Filtering a shared Google Sheet instead of using a filter view Coworkers think rows are missing

Check Your Understanding

1. A coworker sorted the Last Name column of a staff list, and now the phone numbers do not match the names. They have not closed the file. What do you do?

Press Ctrl+Z to undo the sort. If that is no longer possible, restore an earlier version from version history. Then sort again with the whole list selected, or with one cell clicked in Excel, so whole rows move together.

2. You filter a parts list to show only the Shop location. The total under the list still shows the total for every location. Why?

The total uses SUM, which counts hidden rows. Change it to =SUBTOTAL(9, followed by the same range, and it will add only the rows that are showing.

3. You sort a ticket list by Priority, and it comes out Critical, High, Low, Medium. How do you get Critical, High, Medium, Low?

In Excel, sort with a custom list typed in that order. In Google Sheets, add a helper column that turns each priority into a number from 1 to 4 and sort by that column.

4. Ten people use one Google Sheet. You need to see only your region's rows for an hour. What should you use?

A filter view (Data > Create filter view). A regular filter would change what everyone else sees.

Key Takeaways

  • Check for one header row, no blank rows and no merged cells before you sort.
  • In Excel, click one cell and let the program find the list. In Google Sheets, select the whole list or use Sort sheet with the header frozen.
  • Never sort one column alone. Undo right away if it happens.
  • A filter hides rows and deletes nothing. Look for the filter signs before you report a count.
  • Use SUBTOTAL, not SUM, to total a filtered list.
  • In a shared Google Sheet, use a filter view so you do not change what others see.