LEN Function in Apple Numbers: Syntax, Examples, and Troubleshooting
Count text graphemes including spaces to validate IDs and text fields in Apple Numbers.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
LEN counts graphemes in a text value, including spaces, numbers and punctuation. Apple’s reference explicitly treats a character with diacritics as one grapheme. This is a text-length measure, not a byte count.
Availability and version history
- Introduced: Documented in Apple’s Formulas and Functions Help 15.4; the original introduction release is not established.
- Availability: Currently documented in Apple’s Formulas and Functions Help 15.4 edition; this is not a Numbers app version or a final supported-version endpoint.
- Scope: Shared iWork function help. Availability in individual clients and older releases is not established by this check.
- Checked: October 14, 2026, against the official LEN reference. Official documentation and independent text checks; no native Numbers execution.
Syntax and the intended text contract
LEN(source-string)
The LEN reference has one required argument described as any value. The return is the number of graphemes in a string. These worksheets deliberately use known text so that custom numeric/date formatting and import conversion do not become hidden assumptions.
For identifiers, format source cells as Text before entry if necessary. Converting a value such as 0012 into the number 12 discards characters; LEN cannot recover them afterward.
Preserve the original five text values
Create References, with seven columns A:G and six rows, including one header row. Put Reference text, Raw length, Trimmed text, Trimmed length, Removed, Six characters? and Unchanged? in A1:G1.
Enter A2:A6 exactly as follows, without the surrounding backticks. The accented e in Café is the ordinary composed character é.
| Row | A — Text | Expected raw length |
|---|---|---|
| 2 | AB-102 |
6 |
| 3 | M42, one ordinary space at each end |
5 |
| 4 | Café |
4 |
| 5 | X Y, two ordinary internal spaces |
4 |
| 6 | A9 |
2 |
B2 =LEN(A2) filled through B6 gives 6,5,4,4,2, preserving the original results. A space contributes to the count whether it occurs at an edge or between letters. For the specified composed Café, four graphemes occupy five bytes in UTF-8; the byte count is a separate encoding calculation, not a Numbers output.
Compare raw length with a deliberately cleaned version
Enter C2 =TRIM(A2), D2 =LEN(C2), E2 =B2-D2, F2 =B2=6 and G2 =EXACT(A2,C2). Fill C2:G2 through row 6.
| Row | Expected C | D | E | F | G |
|---|---|---|---|---|---|
| 2 | AB-102 | 6 | 0 | TRUE | TRUE |
| 3 | M42 | 3 | 2 | FALSE | FALSE |
| 4 | Café | 4 | 0 | FALSE | TRUE |
| 5 | X Y | 3 | 1 | FALSE | FALSE |
| 6 | A9 | 2 | 0 | FALSE | TRUE |
The original row-3 expressions =LEN(A3), =LEN(TRIM(A3)) and =LEN(A3)-LEN(TRIM(A3)) therefore remain 5,3,2. TRIM removes the two exterior ordinary spaces. Row 5 illustrates that it also reduces repeated internal spaces.
Column E measures characters removed under that cleanup policy. G checks complete case-sensitive text agreement using EXACT. Neither column establishes the identity of a customer or the validity of a code.
Check Apple’s literal examples separately
Create LengthControls, with three columns and four rows. Put =LEN("12345") in A2 for 5 and =LEN(" abc def ") in A3 for 9, matching Apple’s examples. The second text contains six letters plus three spaces: leading, separating and trailing.
In B3 enter =LEN(TRIM(" abc def ")) for 7, and in C3 enter =A3-B3 for 2. The one internal separator remains; trimming does not concatenate the two words.
Advanced: length checks cannot validate a whole identifier
Create LengthPolicy, with five columns and seven rows. Enter these six text values in A2:A7: AB-102, AB 102, AB-XYZ, ABCDE1, AB-10 and ** AB-10**. The last has one leading space.
B2 =LEN(A2) filled through B7 gives 6,6,6,6,5,6. C2 =B2=6 filled through C7 is TRUE except for row 6. Several visibly different structures pass the same length rule.
In D2 put =AND(LEN(A2)=6,LEFT(A2,2)="AB",MID(A2,3,1)="-") and fill through D7. Only rows 2 and 4, AB-102 and AB-XYZ, pass. All inputs here are at least five characters long, so the positive-position LEFT/MID checks are within Apple’s documented bounds.
E2 =IF(D2,"Structure matches","Check structure") filled through E7 labels those two rows Structure matches. The label deliberately does not say the identifier is valid: AB-XYZ passes the prefix, delimiter and length rules despite containing no digits in the final field.
This is a concrete reason to separate a length rule from the remaining schema rules. LEFT and MID provide structural pieces; permitted values and digit requirements are additional decisions.
Unicode, empty inputs and meaningful formatting
The original composed accent example follows Apple’s grapheme statement. It does not measure every combining-mark sequence, emoji cluster, normalization form or historical implementation. Do not substitute Python code-point length or another program’s Unicode compatibility mode for native Numbers evidence.
A truly empty cell, a formula returning empty text and a custom-formatted number are distinct input cases. Their complete conversion behavior is not established by these text fixtures. Keep an explicit text policy rather than relying on how similar-looking cells happen to display.
Platform and text boundaries
These examples use local references within the named Numbers table. English multi-argument formulas use commas; Apple’s syntax guidance specifies semicolons when the decimal separator is a comma. A one-argument formula such as LEN or TRIM has no argument separator to change.
The help edition does not establish identical Unicode, imported-value, numeric/date conversion or error behavior in every client and historical release. Keep identifiers as text when zeros, spaces or punctuation matter. A matching length or cleaned label is not proof of a valid or unique record.