Complete guide to sorting, filtering, tables, data validation, and data cleanup in Excel.
Sorting
Basic Sort
Single column sort:
- Select any cell in the column
- Data > Sort A to Z (ascending) or Z to A (descending)
- Or use toolbar buttons
Sort Options
| Option | Effect |
|---|---|
| Sort A to Z | Ascending (A-Z, 0-9, oldest-newest) |
| Sort Z to A | Descending (Z-A, 9-0, newest-oldest) |
| Sort by Color | Cell color or font color |
| Custom Sort | Multi-level, custom order |
Multi-Level Sort
- Data > Sort
- Add Level for each sort column
- Set order priority (top = primary)
Example:
Level 1: Region (A to Z)
Level 2: Date (Newest to Oldest)
Level 3: Amount (Largest to Smallest)Sort Settings
| Setting | Options |
|---|---|
| My data has headers | Include/exclude header row |
| Case sensitive | Distinguish A vs a |
| Sort left to right | Sort by rows instead of columns |
| Order | A to Z, Z to A, Custom List |
Custom Sort Order
Built-in lists:
- Days of week (Sun, Mon, Tue...)
- Months (Jan, Feb, Mar...)
Create custom list:
- File > Options > Advanced > Edit Custom Lists
- Enter values or import from range
- Use in Sort dialog
Sort by Color
Sort based on:
- Cell fill color
- Font color
- Cell icon (from conditional formatting)
Order options:
- On Top
- On Bottom
Keyboard Shortcuts
| Action | Shortcut |
|---|---|
| Sort ascending | Alt+A, S, A |
| Sort descending | Alt+A, S, D |
| Custom sort | Alt+A, S, S |
Filtering
AutoFilter
Enable filter dropdowns:
- Select header row
- Data > Filter
- Or Ctrl+Shift+L
Filter Types
| Type | Use For |
|---|---|
| Text Filters | Text columns |
| Number Filters | Numeric columns |
| Date Filters | Date columns |
| Filter by Color | Colored cells |
Text Filters
| Option | Matches |
|---|---|
| Equals | Exact match |
| Does Not Equal | Exclude exact match |
| Begins With | Starting text |
| Ends With | Ending text |
| Contains | Text anywhere |
| Does Not Contain | Exclude text |
| Custom Filter | Complex conditions |
Number Filters
| Option | Condition |
|---|---|
| Equals | = value |
| Does Not Equal | <> value |
| Greater Than | > value |
| Greater Than Or Equal | >= value |
| Less Than | < value |
| Less Than Or Equal | <= value |
| Between | range |
| Top 10 | Top/bottom n or % |
| Above Average | > mean |
| Below Average | < mean |
Date Filters
| Category | Options |
|---|---|
| Specific | Equals, Before, After, Between |
| Relative | Today, Yesterday, Tomorrow |
| Period | This Week/Month/Quarter/Year |
| Dynamic | Last 7 Days, Year to Date, etc. |
Filter by Selection
Quick filter methods:
- Right-click cell > Filter > Filter by Selected Cell's Value
- Filter by Color
- Filter by Icon
Multiple Criteria
Within same column (OR):
- Check multiple items in dropdown
- Use Custom Filter with OR
Across columns (AND):
- Apply filters to multiple columns
- All conditions must match
Advanced Filter
Data > Advanced for complex criteria:
- Filter in place or copy to location
- Criteria range with headers
- Unique records only
Criteria range format:
| Column1 | Column2 |
|---------|---------|
| >100 | ="East" |
| >200 | |Clear Filters
| Action | Method |
|---|---|
| Clear single column | Click filter > Clear Filter |
| Clear all filters | Data > Clear |
| Remove AutoFilter | Data > Filter (toggle off) |
Filter Indicators
| Indicator | Meaning |
|---|---|
| Dropdown arrow | No filter applied |
| Funnel icon | Filter active on column |
| Row numbers blue | Rows are filtered |
Tables
Creating a Table
- Select data range (including headers)
- Insert > Table
- Or Ctrl+T
- Confirm "My table has headers"
Table Benefits
| Feature | Description |
|---|---|
| Auto-expand | New rows/columns included automatically |
| Structured references | [@Column] syntax in formulas |
| Auto-fill formulas | Formulas copy to new rows |
| Built-in styles | Banded rows, header formatting |
| Filter buttons | AutoFilter enabled by default |
| Total row | Summary calculations |
| Remove duplicates | Built-in tool |
Table Parts
| Part | Description |
|---|---|
| Header Row | Column names (always visible) |
| Data Body | Data rows |
| Total Row | Optional summary row |
| First Column | Optional special formatting |
| Last Column | Optional special formatting |
| Banded Rows | Alternating row colors |
| Banded Columns | Alternating column colors |
Structured References
Reference table data by name:
| Reference | Meaning |
|---|---|
| TableName | Entire table |
| TableName[Column] | Single column |
| TableName[[Column1]:[Column2]] | Column range |
| TableName[#All] | Entire table with headers |
| TableName[#Data] | Data only (no headers) |
| TableName[#Headers] | Header row |
| TableName[#Totals] | Total row |
| [@Column] | This row's value in Column |
| [@[Column Name]] | Brackets for names with spaces |
Total Row Functions
| Function | Calculates |
|---|---|
| None | No calculation |
| Average | Mean value |
| Count | Count of values |
| Count Numbers | Count numeric only |
| Max | Maximum value |
| Min | Minimum value |
| Sum | Total |
| StdDev | Standard deviation |
| Var | Variance |
| More Functions | Custom formula |
Table Styles
Built-in styles:
- Light (21 styles)
- Medium (28 styles)
- Dark (11 styles)
Custom style:
- Table Design > More > New Table Style
- Format each element
- Set as default (optional)
Convert Table to Range
- Select table
- Table Design > Convert to Range
- Keeps data and formatting
- Loses table features
Resize Table
- Table Design > Resize Table
- Or drag corner handle
- Adjust range reference
Data Validation
Creating Validation Rules
- Select cells
- Data > Data Validation
- Set criteria, input message, error alert
Validation Types
| Type | Restricts To |
|---|---|
| Any value | No restriction |
| Whole number | Integers |
| Decimal | Numbers with decimals |
| List | Predefined options |
| Date | Date range |
| Time | Time range |
| Text length | Character count |
| Custom | Formula-based |
Criteria Options
| Operator | Meaning |
|---|---|
| between | Min and Max |
| not between | Outside range |
| equal to | Exact value |
| not equal to | Not exact value |
| greater than | > value |
| less than | < value |
| greater than or equal to | >= value |
| less than or equal to | <= value |
List Validation (Dropdown)
From range:
Source: =$A$1:$A$10
Source: =CategoriesDirect entry:
Source: Yes,No,Maybe
Source: North,South,East,WestOptions:
- In-cell dropdown
- Ignore blank
Input Message
| Setting | Purpose |
|---|---|
| Title | Message box title |
| Input message | Help text for user |
| Show when selected | Enable/disable message |
Error Alert
| Style | Behavior |
|---|---|
| Stop | Reject invalid entry |
| Warning | Allow with warning |
| Information | Allow with info |
| Setting | Purpose |
|---|---|
| Title | Error box title |
| Error message | Explanation text |
Formula-Based Validation
Examples:
=A1>B1 A must be greater than B
=LEN(A1)<=10 Max 10 characters
=ISNUMBER(A1) Must be number
=A1<TODAY() Must be past date
=COUNTIF($A:$A,A1)=1 No duplicates
=MOD(A1,1)=0 Whole numbers only
=AND(A1>=1,A1<=100) Between 1 and 100Circle Invalid Data
Highlight cells failing validation:
- Data > Data Validation > Circle Invalid Data
- Red circles appear on invalid cells
- Data > Clear Validation Circles to remove
Copy Validation
- Copy cell with validation
- Paste Special > Validation
Remove Validation
- Select cells
- Data > Data Validation > Clear All
Data Cleanup
Remove Duplicates
- Select range or table
- Data > Remove Duplicates
- Choose columns to check
- Click OK
Options:
- Check all columns
- Select specific columns
- My data has headers
Text to Columns
Split text into multiple columns:
- Select column
- Data > Text to Columns
- Choose delimiter or fixed width
Delimiters:
- Tab
- Semicolon
- Comma
- Space
- Other (custom)
Fixed width:
- Set break lines manually
- Preview result
Trim Spaces
Remove extra spaces:
=TRIM(A1)Removes:
- Leading spaces
- Trailing spaces
- Multiple spaces between words
Clean Non-Printable Characters
=CLEAN(A1)Removes ASCII characters 0-31.
Change Case
| Formula | Result |
|---|---|
| =UPPER(A1) | UPPERCASE |
| =LOWER(A1) | lowercase |
| =PROPER(A1) | Title Case |
Find and Replace
Ctrl+H for Replace dialog:
- Find what: Text to find
- Replace with: Replacement text
- Match case: Case sensitive
- Match entire cell contents: Exact match
- Use wildcards: * and ?
Special replacements:
- ^p = Paragraph mark
- ^t = Tab character
- ^? = Any character
- ^# = Any digit
- ^$ = Any letter
Flash Fill
Automatically fill based on pattern:
- Enter example in adjacent column
- Press Ctrl+E
- Or Data > Flash Fill
Use for:
- Extracting parts of text
- Combining text
- Reformatting data
- Standardizing formats
Fill Blank Cells
- Select range with blanks
- Go To Special > Blanks (Ctrl+G > Special)
- Type formula (e.g., =A2)
- Ctrl+Enter to fill all
Consolidate Data
Combine data from multiple ranges:
- Data > Consolidate
- Choose function (Sum, Average, Count, etc.)
- Add source ranges
- Options: Top row, Left column labels
Data Tools
Goal Seek
Find input value for desired result:
- Data > What-If Analysis > Goal Seek
- Set cell: Result cell
- To value: Desired result
- By changing cell: Input cell
Scenario Manager
Save multiple input sets:
- Data > What-If Analysis > Scenario Manager
- Add scenarios
- Show different scenarios
- Create summary report
Data Table
One-variable:
- Set up formula and input values
- Data > What-If Analysis > Data Table
- Column/Row input cell
Two-variable:
- Row inputs across, column inputs down
- Formula in corner
- Both input cells specified
Group and Outline
Group rows/columns:
- Select rows/columns
- Data > Group
- Or Alt+Shift+Right
Auto Outline:
- Data > Group > Auto Outline
- Creates groups from formulas
Controls:
- +/- buttons to expand/collapse
- Level buttons (1, 2, 3...)
Subtotals
Add automatic subtotals:
- Sort by grouping column
- Data > Subtotal
- At each change in: Grouping column
- Use function: Sum, Count, etc.
- Add subtotal to: Value columns
Remove:
- Data > Subtotal > Remove All
Import/Export
Import Data
Data > Get Data:
- From File (Excel, CSV, XML, JSON)
- From Database
- From Online Services
- From Other Sources
Text Import
Delimited files:
- Set delimiter
- Choose data formats
- Specify start row
Fixed width:
- Set column breaks
- Preview data
Export to CSV
Save As > CSV (Comma delimited)
Note:
- Single sheet only
- Loses formatting
- No formulas (values only)
Copy/Paste Options
Paste Special (Ctrl+Alt+V):
- Values
- Formulas
- Formats
- Column widths
- Validation
- Comments
- Transpose
- Skip blanks
- Operations (Add, Subtract, Multiply, Divide)
excel-advanced-formulas
Modern Excel 365/2021+ formulas — LAMBDA and LAMBDA helpers (MAP, REDUCE, SCAN, BYROW, BYCOL), LET, dynamic arrays (FILTER, SORT, UNIQUE, HSTACK, VSTACK, TAKE, DROP), TEXTSPLIT, REGEX functions, GROUPBY and PIVOTBY.
excel-formulas
Write error-free Excel formulas — syntax rules, cell references, math, logical, lookup (VLOOKUP, INDEX/MATCH, XLOOKUP), text, date/time and conditional aggregation (SUMIFS, COUNTIFS) with error handling.