## You are learning Sorting and Filtering in MS Excel

How to sort and filter data based on text length in Excel?

There are two main ways to sort and filter data based on text length in Excel:

Method 1: Using the LEN function and Sort

1. Create a helper column: In a new column (e.g., Column C), enter the formula `=LEN(A1)` (replace A1 with the cell reference of your text data). This formula uses the LEN function to count the number of characters in each cell of your text data (in column A in this example). Drag the formula down to apply it to all your data.

2. Sort by Text Length: Select your entire data range (including the header row) and navigate to the "Data" tab. Click the "Sort" button (or press Alt+A+S).

3. Sort by Helper Column: In the "Sort By" dropdown menu, choose the header cell of your helper column (e.g., "C" for the LEN formula results).

4. Choose Sort Order: Select "Ascending" to sort from shortest to longest text or "Descending" for longest to shortest.

5. Sort with or without Header Row: Check the "My data has headers" box if your first row contains column labels.

6. Click OK: Click "OK" to sort your data based on the text length displayed in the helper column.

Method 2: Using the SORTBY function (Microsoft 365 only)

1. Sort by Formula (Microsoft 365): If you have Microsoft 365 Excel, you can use the SORTBY function directly. In an empty cell (e.g., D1), enter the formula:

`=SORTBY(A1:A10, LEN(A1:A10), ,-1)`

- Replace A1:A10 with your actual text data range.

- The ", ," part is optional and can be used for additional sorting criteria.

- The "-1" at the end sorts in descending order (longest to shortest). Change to "1" for ascending order.

2. Drag the Formula Down: Drag the formula in cell D1 down to apply it to all rows corresponding to your data. This will display the sorted data based on text length.

Filtering by Text Length:

Unfortunately, Excel doesn't have a direct filter for text length. However, you can combine these sorting methods with manual filtering to achieve your desired outcome.

For example, after sorting with either method, you can use the filter arrows on the header row of the helper column (text length) to filter and show only short or long text entries.