LEN
Returns the number of characters in a text value.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=LEN(text)
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
text | any | Required | — |
Remarks
- Counts Unicode scalar characters, not bytes.
- Empty values return
0. - Non-text values are converted to their text form before counting.
- Errors are propagated unchanged.
Examples
Count the length of a label containing an internal space.
Formula =LEN("East 2024")
Expected result 9
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Measure text containing non-ASCII characters.
Formula =LEN("é界")
Expected result 2
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Empty text has a length of zero.
Formula =LEN("")
Expected result 0
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
A division-by-zero input propagates.
Formula =LEN(1/0)
Expected result #DIV/0!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Basic text length
Formula =LEN("hello")
Expected result 5
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Whitespace is counted
Formula =LEN("a b")
Expected result 3
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
Does LEN ignore spaces?
No. LEN counts spaces and other visible characters as part of the total length.