Excel LEN function: count characters in a cell
LEN returns how many characters a cell holds, including spaces. =LEN(A2) returns 4 for "Dana". Comparing LEN(G2) with LEN(TRIM(G2)) shows whether a cell has extra spaces.
Column G holds each rep's contact name, typed messily on purpose: " dana ruiz", "LUIS ortega ", "priya shah". That's what exported lists look like.
Syntax
=LEN(text)
Examples
=LEN(A2)returns 4.=LEN(G3)returns 12 for "LUIS ortega ", because the trailing space counts.=LEN(TRIM(G3))returns 11.
Find cells with extra spaces
=LEN(G2)<>LEN(TRIM(G2)) returns TRUE when a cell has extra spaces. Use it with conditional formatting to highlight the messy rows.
Check ID and phone lengths
Data entry tests often ask you to flag wrong-length entries. =IF(LEN(A2)=10,"OK","Check") flags anything that isn't 10 characters, like a phone number missing a digit.
Count a character
To count how many times a letter appears, remove it and compare lengths: =LEN(A2)-LEN(SUBSTITUTE(A2,"a","")) counts the lowercase a's in a cell.
Watch out for
- Numbers are counted as displayed in the formula bar, not with formatting.
=LEN(1250)is 4, even if the cell shows $1,250.00. - Non-breaking spaces from websites count as characters but TRIM won't remove them. See cleaning text.
Try it: Count characters after cleanup
In C2, count how many characters Dana's contact (G2) has once extra spaces are removed.
Graded live, like a real Excel test. Press New numbers to prove you didn't memorize the answer. More practice
Questions people ask
Does LEN count spaces?
Yes. Every space counts, including ones at the start and end.
Is there a LEN for bytes?
Excel has LENB for double-byte languages. For English text it returns the same as LEN.
Practice on a real spreadsheet
CellReady grades your formula the moment you press Enter and tells you why a wrong answer is wrong. The first 7 lessons are free, with no sign-up to start.
Related guides
Fix extra spaces and random capitals in Excel with TRIM, PROPER, UPPER and LOWER, plus the cases they miss and a live exercise.
How to extract characters from text in Excel with LEFT, RIGHT and MID, how to split first and last names with FIND, and a live exercise.
How the Excel IF function works, with text and number results, AND and OR, nested IFs, the #NAME? mistake, and a live exercise.