What it does
LEN counts the number of characters in a text value.
Syntax or pattern
=LEN(text)5 practical examples
Count characters in a cell
Return the length of a product code.
=LEN(A2)Includes spaces.
Find long entries
Flag names longer than 30 characters.
=IF(LEN(A2)>30,"Too long","OK")Useful for data validation checks.
Count characters without spaces
Remove spaces before counting.
=LEN(SUBSTITUTE(A2," ",""))Useful when spaces should not count.
Find blank-looking cells
Check cells with hidden spaces.
=LEN(A2)A result greater than 0 means something is there.
Validate code length
Check that an ID has exactly 8 characters.
=IF(LEN(A2)=8,"OK","Check")Good for imported IDs.
Common mistakes to avoid
- Not handling missing delimiters.
- Forgetting that some text functions return text, not numbers.
- Using fixed positions when the text layout is not consistent.
Related Excel examples
FAQ
Can text formulas work with Excel Tables?
Yes. Table references can make text-cleaning formulas easier to understand.
Here are some ideas for you
Optional resources that may help if you are learning formulas, building reports, or working in spreadsheets often.
- Excel formula booksSee ideas
Practice formulas with structured examples you can keep beside your desk.
- Excel shortcut guidesSee ideas
Build speed with keyboard shortcuts for selection, formatting and navigation.
- Numeric keypadsSee ideas
Helpful if you enter many numbers on a laptop or compact keyboard.
- External monitorsSee ideas
Useful for viewing large worksheets, formulas and reference tables side by side.
- Desk notebooksSee ideas
Sketch formula logic, report ideas and table structures before building.
- Laptop standsSee ideas
Make long spreadsheet sessions more comfortable and ergonomic.
Some links in this section may be affiliate links. Choose only what is useful for your own work.