Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Filter and Sort in Excel: A Complete Guide

· 7 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To put a filter and sort in Excel, highlight your data range or click any cell within your table, go to the Data tab on the top ribbon, and click the Filter button. This adds drop-down arrows to your header row, allowing you to sort data alphabetically or numerically and filter out specific values to view only the information you need. Sorting reorganizes the order of your rows, while filtering hides rows that do not meet your chosen criteria.

What You'll Need

  • A computer with Microsoft Excel installed (Windows or macOS).
  • A dataset organized in a tabular format with clear header labels in the first row.
  • Data that is contiguous, meaning there are no entirely empty rows or columns breaking up the dataset.

Step-by-Step

  1. Prepare Your Data: Ensure your data is organized correctly. Every column must have a unique header in the first row (e.g., "Date," "Customer Name," "Amount"). Make sure there are no completely blank rows or columns within the body of your data, as Excel uses these gaps to determine where a data range ends.
  2. Activate the Filter: Click any single cell inside your data range. Navigate to the top menu ribbon and click on the Data tab. In the Sort & Filter group, click the Filter button. You will now see small drop-down arrows appearing in the bottom-right corner of each header cell. Note that labels may differ slightly depending on your version of Excel or region.
  3. Sorting Your Data: Click the drop-down arrow in the column you wish to organize. You will see options to Sort A to Z (ascending) or Sort Z to A (descending). For numerical data, this will appear as Sort Smallest to Largest or Sort Largest to Smallest. Once selected, Excel will automatically rearrange the entire row to ensure the data stays connected across columns.
  4. Applying a Basic Filter: Click the drop-down arrow in the column you want to filter. In the menu that appears, you will see a list of all unique values present in that column with checkboxes next to them. Uncheck (Select All) to clear the list, then check only the specific boxes for the data you want to see. Click OK, and Excel will hide all rows that do not match your selection.
  5. Using Advanced Text, Number, or Date Filters: Instead of checking boxes, you can use logic-based filters. Click the drop-down arrow and hover over Text Filters (for words), Number Filters (for digits), or Date Filters (for dates). From here, you can choose specific rules such as "Contains," "Begins With," "Greater Than," or "Between." For example, selecting "Greater Than" in a price column allows you to see only items costing more than a specific amount.
  6. Clearing Filters: To return to your full dataset, you can either click the filter icon on the specific column and select Clear Filter From [Column Name], or go back to the Data tab and click the Clear button next to the Filter icon to remove all active filters across the entire sheet.
  7. Removing the Filter Feature: To remove the drop-down arrows entirely from your headers, click the Filter button in the Data tab again. This toggles the feature off and restores the header row to its original appearance.

Common Mistakes

One of the most frequent errors is failing to include the entire dataset when applying a sort. If you manually highlight only one column and then sort it, Excel may ask if you want to "Expand the selection." If you choose "Continue with the current selection," Excel will sort only that specific column, effectively disconnecting the data from the rest of the row. This ruins the integrity of your database because the names in column A will no longer match the values in column B.

Another common mistake is leaving blank rows within the data. Excel's "Auto-Filter" logic assumes that a blank row signifies the end of the table. If you have a completely empty row at line 10, and you click Filter at line 5, Excel will only apply the filter to rows 1 through 9. To fix this, either delete the blank rows or manually highlight the entire range of data before clicking the Filter button.

Users also frequently confuse sorting with filtering. Sorting changes the physical order of the rows on the sheet, while filtering merely hides rows from view. If you filter a list and then perform a calculation (like a sum) using a standard formula, Excel may still count the hidden rows. You must use specific functions like SUBTOTAL to calculate only the visible filtered data.

Tips

For those who work with large datasets frequently, converting your data range into an official Excel Table is highly recommended. To do this, click anywhere in your data and press Ctrl + T (Windows) or Cmd + T (Mac). Tables automatically enable filter arrows in the header row and, more importantly, they expand automatically. If you add a new row of data at the bottom, the table (and its filters) will automatically include that new row without you having to re-apply the settings.

If you need to apply multiple complex filters and switch between them often, consider using Slicers. Slicers are visual buttons that act as filters. They are only available for data formatted as a Table or PivotTable. Once your data is a Table, go to the Table Design tab and select Insert Slicer. Choose the columns you want to filter by, and you will get floating buttons that allow you to filter your data with a single click rather than navigating drop-down menus.

To sort by more than one criteria—for example, sorting by "Department" first and then by "Last Name" within each department—use the Custom Sort feature. In the Data tab, click the Sort button (the large icon next to the Filter button). This opens a dialog box where you can click Add Level to create a hierarchy of sorting rules.

Troubleshooting

If the Filter button is greyed out and cannot be clicked, check if your worksheet is protected. Go to the Review tab and see if it says Unprotect Sheet. If the sheet is protected, certain data manipulation tools like filtering are disabled until the protection is removed. Additionally, ensure you are not currently editing a cell (where the cursor is blinking inside the cell); Excel disables most ribbon commands until you press Enter or Esc to finish editing.

If you apply a filter but the results seem incorrect or some data is missing, check for leading or trailing spaces in your cells. For example, "Apple" and "Apple " (with a space at the end) are treated as two different values by Excel. You can use the TRIM function in a helper column to remove these invisible spaces and then filter the cleaned column.

If your sort is not working as expected with numbers, check the data format. If numbers are stored as text, Excel will sort them logically (1, 10, 2, 20) rather than numerically (1, 2, 10, 20). To fix this, select the column, click the warning icon that appears next to the cells, and select Convert to Number.

Frequently Asked Questions

Can I filter by color?

Yes. If you have used conditional formatting or manually highlighted cells, click the filter drop-down arrow and select Filter by Color. You can then choose the specific cell or font color you wish to isolate.

Will filtering my data delete the hidden rows?

No. Filtering only hides the rows from view. The data is still present in the workbook; it is simply not visible. To see all your data again, clear the filter or toggle the Filter button off.

How do I filter for multiple specific items?

Click the filter drop-down arrow and check multiple boxes in the list of values. Alternatively, use Text Filters > Custom Filter to set "Or" logic, such as showing rows that contain "North" OR "South".

Can I use filters on a Mac?

Yes, the process is nearly identical on macOS. You can find the Filter option under the Data tab, though the visual style of the ribbon may vary slightly compared to the Windows version.

Why is my sort not including all my columns?

This usually happens if you selected only one column before sorting. Always ensure you select the entire table or click a single cell within the table so Excel can automatically detect the full range before you apply a sort.