LEN Function in Excel, Google Sheets, Airtable & Notion
LEN returns the number of characters in a text string, including spaces and punctuation. LEN("Hello, world") is 12.
Syntax in each app
| App | Support | Syntax & notes |
|---|---|---|
| Excel | ✔ Built in | LEN(text) |
| Google Sheets | ✔ Built in | LEN(text) |
| Airtable | ✔ Built in | LEN(string) |
| Notion | ✔ Built in | length(text)Also works on lists, where it counts items. Method form: prop("Name").length(). |
| Excel | =LEN("Hello, world") | open excel.new ↗ |
|---|---|---|
| Google Sheets | =LEN("Hello, world") | open sheets.new ↗ |
| Airtable | LEN("Hello, world") | |
| Notion | length("Hello, world") |
Excel & Sheets use cell ranges. Paste this sample data into cell A1 of a blank sheet, then paste the formula into any empty cell.
Arguments
| Argument | What it means |
|---|---|
text | The text to measure. Numbers are measured as their stored digits, not their formatted display. |
Examples
| Formula | Result | Why | Copy |
|---|---|---|---|
=LEN("Hello, world") | 12 | Spaces and punctuation count. | |
=LEN(A2)-LEN(TRIM(A2)) | Extra spaces | How many surplus spaces TRIM would remove. | |
=LEN(A2)-LEN(SUBSTITUTE(A2, ",", "")) | Number of commas | Count how often a character appears. | |
=LEN(A2)>280 | TRUE if too long | Check a length limit. |
Examples use Excel / Google Sheets syntax unless noted.
How LEN works
LEN is mostly a building block. Use it to check input lengths (postcodes, IDs, tweet-sized text), with RIGHT and MID to work out how much text is left, and in the classic counting trick: the length before minus the length after removing a character with SUBSTITUTE tells you how many times it appears. Add 1 to the comma count to get the number of items in a comma-separated list.
Invisible characters are counted too. If LEN says 6 for a cell that shows “Apple”, there is a trailing space or a non-breaking space from copied web text. =LEN(TRIM(A2)) shows the cleaned length. A number is measured as stored, so a cell showing $1,000.00 that holds 1000 has a length of 4.
Airtable's LEN and Notion's length() work the same way on text. Notion's length() also counts the items in a list, e.g. how many tags or related pages a row has. All four apps count an emoji as 2 characters.
Frequently Asked Questions
- How do I count words in a cell?
- Count spaces and add one:
=IF(TRIM(A2)="", 0, LEN(TRIM(A2)) - LEN(SUBSTITUTE(TRIM(A2), " ", "")) + 1).