# How to find the longest text in a column in Excel

Find the largest length and return the text that has it: =XLOOKUP(MAX(LEN(A2:A7)),LEN(A2:A7),A2:A7).

**Excel:** `=XLOOKUP(MAX(LEN(A2:A7)),LEN(A2:A7),A2:A7)` (Excel 2021, 2024 and Microsoft 365)

**Google Sheets:** `=ARRAYFORMULA(INDEX(A2:A7,MATCH(MAX(LEN(A2:A7)),LEN(A2:A7),0)))`

## Example

Sample data (row 1 is the header):

| A | B | C |
| --- | --- | --- |
| Product title |  | Longest title |
| Desk lamp |  |  |
| Ergonomic office chair |  |  |
| Adjustable standing desk, walnut |  |  |
| USB-C dock |  |  |
| Noise-cancelling wireless headset |  |  |
| Monitor arm |  |  |

Formula in C2: `=XLOOKUP(MAX(LEN(A2:A7)),LEN(A2:A7),A2:A7)`

Result: Noise-cancelling wireless headset

## How it works

`LEN(A2:A7)` gives the length of every title at once, and MAX picks the largest, 33. XLOOKUP then finds that length in the same list and returns the title on that row.

## Other ways

- `=INDEX(A2:A7,MATCH(MAX(LEN(A2:A7)),LEN(A2:A7),0))`: Without XLOOKUP. In Excel 2019 and earlier, confirm with Ctrl+Shift+Enter.
- `=MAX(LEN(A2:A7))`: Just the length of the longest text. (Returns 33, the number of characters.)

## Common mistakes

- Ties return the first title with that length.
- Trailing spaces count toward the length. Use `LEN(TRIM(A2:A7))` in both places for imported data.

## Questions

**How do I find the shortest text?**

Use MIN: `=XLOOKUP(MIN(LEN(A2:A7)),LEN(A2:A7),A2:A7)`. Blank cells count as length 0, so exclude them if the column has gaps.

**How do I list every title over a length limit?**

Filter by length: `=FILTER(A2:A7,LEN(A2:A7)>30)`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/find-the-longest-text-in-a-column
