Sorting and Filtering Data in Excel: Simple Techniques for Beginners

by | Excel

Table of Contents

Preparing Your Data for Analysis in Excel

Step 1: Input Data

  • Ensure your data is in a table format. Headers should be in the first row.

Step 2: Sorting Data

  1. Select your data range.
  2. Go to the Data tab.
  3. Use Sort to sort based on a specific column.
    • Example: Sort by 'Sales' in ascending order.

Step 3: Filtering Data

  1. Select your data range.
  2. Go to the Data tab.
  3. Click Filter.
  4. Use the dropdown arrows to filter by specific criteria.
    • Example: Filter 'Product Type' to only show 'Electronics'.

Step 4: Removing Duplicates

  1. Select your data range.
  2. Go to the Data tab.
  3. Click Remove Duplicates.
  4. Select the columns you want to check for duplicates.
    • Example: Remove duplicates based on 'Email'.

Step 5: Creating and Using Formulas

Example Formulas:

  • SUM: To get the total.

    =SUM(B2:B10)
    
  • AVERAGE: To find the mean.

    =AVERAGE(B2:B10)
    
  • IF: Conditional data.

    =IF(A2="Electronics", "Yes", "No")
    
  • VLOOKUP: To look up data.

    =VLOOKUP(D2, A2:B10, 2, FALSE)
    

Step 6: Conditional Formatting

  1. Select your data range.
  2. Go to the Home tab.
  3. Click Conditional Formatting.
  4. Apply a rule, such as highlighting cells greater than a certain value.
    • Example: Highlight any sales over $10,000.

Step 7: Data Validation

  1. Select the cells where you want to restrict input.
  2. Go to the Data tab.
  3. Click Data Validation.
  4. Set your criteria.
    • Example: Restrict input to dates only.

Step 8: Creating Pivot Tables

  1. Select your data range.
  2. Go to the Insert tab.
  3. Click PivotTable.
  4. Drag and drop fields to your PivotTable layout to summarize and analyze data.

Step 9: Save and Backup

  1. Save your Excel file to a secure location.
  2. Ensure you have a backup copy.

This end-to-end procedure will help streamline your data preparation for analysis in Excel.

Basic Sorting Techniques in Excel

Sorting Data in Excel

Sort A to Z (Ascending)

  1. Select the column to sort.
  2. Go to the "Data" tab.
  3. Click "Sort A to Z".

Sort Z to A (Descending)

  1. Select the column to sort.
  2. Go to the "Data" tab.
  3. Click "Sort Z to A".

Custom Sort

  1. Select the range to sort.
  2. Go to the "Data" tab.
  3. Click "Sort".
  4. In the Sort dialog box, add levels for columns to sort by.
  5. Choose the order (A to Z or Z to A) for each level.
  6. Click "OK".

Sorting by Multiple Columns

  1. Select the entire data range.
  2. Go to the "Data" tab.
  3. Click "Sort".
  4. Click "Add Level".
  5. Choose the column to sort by first.
  6. Add additional levels as needed.
  7. Click "OK".

Sorting Using Formulas

Sort Smallest to Largest

=SMALL(range, k)

Where range is the range of data to sort, and k is the position of the smallest value to return.

Sort Largest to Smallest

=LARGE(range, k)

Where range is the range of data to sort, and k is the position of the largest value to return.

Sort Using FILTER and SORT Functions (Excel 365)

Sort Ascending

=SORT(range, [sort_index], [order])
  • range: The range to sort.
  • sort_index: The column index to sort by.
  • order: Optional. 1 for ascending, -1 for descending.

Example: Sort Column A

=SORT(A1:A10, 1, 1)

Filtering Data in Excel

Apply Basic Filter

  1. Select the header row.
  2. Go to the "Data" tab.
  3. Click "Filter".

Filter by Criteria

  1. Click the drop-down arrow in the header of the column to filter.
  2. Select the criteria (e.g., text, number, or color).
  3. Click "OK".

Advanced Filtering

  1. Select the data range.
  2. Go to the "Data" tab.
  3. Click "Advanced".
  4. Define the criteria range.
  5. Click "OK".

This guide should enable effective sorting and filtering of data in Excel for practical applications.

Advanced Sorting with Formulas in Excel

1. Sort by Custom Order

You can create a custom list to sort your data by specific criteria.

  1. Select the range you want to sort.
  2. Go to Data > Sort.
  3. Click Order > Custom List....
  4. Enter your custom list, e.g., "High, Medium, Low".
  5. Click OK, and then apply the sort.

2. Sort by Multiple Columns

Use this technique when you want to prioritize more than one sorting criteria.

  1. Select the range.
  2. Go to Data > Sort.
  3. Add levels using Add Level:
    • First column (E.g., Sort by "Department").
    • Add another level (E.g., Then by "Date").
  4. Click OK to sort.

3. Sort with Helper Column and Formula

Create a helper column to extract key information, then sort by that column.

Example: Sorting by the last name in a "Full Name" column

  1. Add Helper Column:

    =TRIM(RIGHT(A2, LEN(A2) - FIND("@", SUBSTITUTE(A2, " ", "@", LEN(A2) - LEN(SUBSTITUTE(A2, " ", ""))))))
    
    • Here, assuming "Full Name" is in "A" column.
  2. Apply Sorting:

    • Select the range that includes the helper column.
    • Go to Data > Sort.
    • Sort by the helper column.

4. Sort by Formulas in Filtered Data

You can sort data in a filtered list using visible cells only.

  1. Filter data using Data > Filter.

  2. Apply SUBTOTAL formula to only include filtered rows:

    =SUBTOTAL(103, [@ColumnName])
    
    • Use 103 for counting visible cells.
  3. Sort by this new column using usual sort methods.

5. Dynamic Sorting using Array Formulas (for Excel 365/2019)

Use dynamic arrays to create automatic sorting.

Example: Sort in ascending order

=SORT(A2:A10)
  • Automatically sorts the range A2:A10 in ascending order.

Sort by another column

=SORT(A2:B10, 2, 1)
  • Sorts the range A2:B10 by the second column (B) in ascending order.

6. Sort by Color

Use sorting by cell or font color for enhanced visualization.

  1. Select the range you want to sort.
  2. Go to Data > Sort.
  3. In Column, choose the column by which you want to sort.
  4. In Sort On, choose Cell Color or Font Color.
  5. Select the color, then click OK.

Example Dataset in Use:

**Initial Dataset:**
Full Name       | Department   | Date
--------------- | ------------ | ----------
John Doe        | HR           | 01/15/2023
Jane Smith      | IT           | 03/22/2023
Bob Johnson     | Marketing    | 05/05/2023
Alice Williams  | HR           | 02/10/2023
Mark Brown      | IT           | 12/25/2022

**Advanced Sorting:** 
- By `Department`, then by `Date`.
- Using Helper Column for `Full Name`.
- Using `SORT` formula for dynamic sorting.

Conclusion

By using these advanced sorting techniques and formulas, you can enhance your data analysis skills in Excel efficiently without needing additional setup or explanation. Simply follow the steps provided for practical implementation.

Applying Filters to Narrow Down Data in Excel

1. AutoFilter

  • Select the header of your data table.
  • Go to Data tab.
  • Click Filter (funnel icon).
  • Filter icons (drop-down arrows) will appear next to each header cell.

Example: Filtering by a Specific Column

  • Click the drop-down arrow of the column you want to filter.
  • Check or uncheck items to filter the data.
  • Click OK to apply the filter.

2. Custom AutoFilter

Example: Text Filters

  • Click the drop-down arrow of the column containing text data.
  • Point to Text Filters and select a condition (e.g., Contains).
  • Enter the filtering criteria and click OK.

Example: Number Filters

  • Click the drop-down arrow of the column containing numerical data.
  • Point to Number Filters and select a condition (e.g., Greater Than).
  • Enter the numeric criteria and click OK.

3. Advanced Filter

Applying Advanced Filter

  • Go to Data tab.
  • Click Advanced in the Sort & Filter group.
  • In the Advanced Filter dialog box, choose Filter the list, in-place or Copy to another location.
  • In the List range box, enter the data range.
  • In the Criteria range box, enter the criteria range.
  • Click OK.

4. Filter by Using Formulas

Using Logical Functions in Filters

  1. Add a new column for your formula.
  2. Use logical functions like IF, AND, and OR for complex criteria.
  3. Apply a custom filter based on the results.

Example

=IF(AND(A2 > 100, B2 < 50), "Include", "Exclude")
  • Filter the new column where the result is "Include".

5. Slicers (Pivot Tables)

Adding Slicers

  • Click anywhere in the PivotTable.
  • Go to PivotTable Analyze tab.
  • Click Insert Slicer.
  • Select the fields to create slicers and click OK.

Using Slicers to Filter Data

  • Click the buttons in the slicer to filter the data in the PivotTable.

This is a practical implementation of data filtering techniques in Excel.

Advanced Filtering Functions in Excel

Step-by-Step Guide

  1. Create a Dataset:
    Ensure you have a dataset in Excel, e.g., a table with columns such as Date, Sales, Region, Product, etc.

  2. Formulas for Filtering:

    • Use SUBTOTAL for dynamic counting or summing:
      =SUBTOTAL(109, B2:B100)  // for visible cells sum in the range B2:B100
      =SUBTOTAL(103, B2:B100)  // for visible cells count in the range B2:B100
      
  3. Advanced Filter Setup:

    • Define Criteria Range:
      Create a criteria range above or beside your data table. Set headers that match the columns in your data.

      Example criteria range:

      Region  |  Sales
      East    |  >500
      
    • Apply Advanced Filter:

      • Go to Data tab.
      • Click on Advanced in the Sort & Filter group.
      • Fill in the dialog box:
        • List range: Your data range, e.g., A1:D100.
        • Criteria range: Your criteria range, e.g., G1:H2.
        • Choose Filter the list, in-place or Copy to another location.
  4. Using FILTER Function for Dynamic Filtering (Excel 365/Excel 2019):

    • Syntax:
      =FILTER(array, include, [if_empty])
      
      • Example:
        =FILTER(A2:D100, (C2:C100="East") * (B2:B100>500), "No results")
        

        This filters the range A2:D100 where Region is "East" and Sales > 500.

  5. Combining INDEX and MATCH for Advanced Lookups:

    • Formula:
      =INDEX(A2:D100, MATCH(1, (C2:C100="East") * (B2:B100>500), 0), 1)
      

      This returns the value from the first column of A2:D100 where Region is "East" and Sales > 500.

  6. Using AGGREGATE for Conditional Calculations on Filtered Data:

    • Example for Sum:
      =AGGREGATE(9, 3, B2:B100/(C2:C100="East"), 1)
      
    • Example for Count:
      =AGGREGATE(2, 3, B2:B100/(C2:C100="East"), 1)
      

With these methods, you can effectively filter and analyze your data using advanced functions in Excel!

#6 Creating and Using Custom Lists in Excel

1. Creating Custom Lists

  1. Open Excel and go to File > Options.
  2. Select Advanced from the left-hand menu.
  3. Scroll down to the General section, and click on the Edit Custom Lists button.
  4. In the Custom Lists dialog box, create a new list by adding items in the List Entries box, separated by commas or one per line.
  5. Click Add, then OK to save the custom list.

2. Using Custom Lists in Sorting

  1. Highlight the data range you wish to sort.
  2. Go to the Data tab and click on Sort.
  3. In the Sort dialog box, select the column you want to sort by.
  4. Choose Custom List from the Order dropdown.
  5. Select your custom list from the options and click OK.
Data Tab > Sort > Column Selection > Order Dropdown > Custom List > Select Custom List > OK

3. Using Custom Lists in AutoFill

  1. Select the starting cell for your custom list.
  2. Enter the first item from your custom list.
  3. Click and drag the fill handle across or down the range you want to populate with the custom list.
  4. Release the mouse button to auto-fill the range with sequential items from your custom list.
Enter First Item > Click and Drag Fill Handle > Release Mouse

4. Using Custom Lists with Formulas

  1. Use custom lists in formulas for conditional formatting, such as checking if an item exists within your custom list.
  2. Example using MATCH:
    =IF(ISNUMBER(MATCH(A2, {"Item1", "Item2", "Item3"}, 0)), "In List", "Not in List")
    
  3. Example using VLOOKUP:
    =IF(NOT(ISNA(VLOOKUP(A2, {"Item1"; "Item2"; "Item3"}, 1, FALSE))), "In List", "Not in List")
    

Conclusion

This implementation allows you to create and use custom lists in Excel for sorting, auto-filling, and using them in formulas, adding versatility and efficiency to your data analysis tasks.

Related Posts