LEN

LEN returns the number of characters in a text string, counting every space, punctuation mark, and invisible character. The simplest text function in Excel and the bedrock for validation, truncation, and data-quality checks.

TextBeginner
Purpose
Count the number of characters in a piece of text, including spaces.
Returns
A whole number: the character count
Syntax
=LEN(text)
Excel version
Every version of Excel since the function was added

How LEN works

LEN takes one piece of text and tells you how many characters it contains. Letters, digits, punctuation, spaces, and line breaks all count as one character each.

If you pass a number, LEN converts it to text first and then counts the digits, so LEN(12345) returns 5. If the cell is blank, LEN returns 0.

The function is most useful nested inside other formulas: comparing LEN of two cells, building a progress message, or feeding the count into IF for conditional logic.

= LEN(text)

Arguments

ArgumentTypeRequiredDescription
texttext✓ RequiredThe string whose length you want. Almost always a cell reference like A2. Numbers, dates, and booleans are converted to their text representation first.

LEN basic: count characters in a product title

You manage a Shopify store. The platform limits product titles to 60 characters and rejects anything longer at upload time. Before importing 800 SKUs you want a column showing the length of every title so you can spot the offenders.

=LEN(A2)
  • A2 -> the cell holding the product title
  • Returns -> an integer: the character count, spaces included
  • Drag down -> the formula adjusts to A3, A4, ... for every row
B2
fx
=LEN(A2)
ABC
1Product titleLength
2Wireless mouse14
3Mechanical keyboard with backlight33
427" UltraSharp HD monitor25
5USB-C hub9
6Adjustable laptop stand for desk32
7HD webcam with built-in microphone34
8LED desk lamp13
9Cable manager kit17
10Wireless headset with active noise cancelling45
Formula entered in cell B2. Drag down to count every title.
Every title sits well below the 60-character limit. The next example flags titles that bust the cap.

LEN inside IF: flag rows that exceed a character limit

Reading the count is fine for ten rows. For eight hundred you want a column that says OK or Too long so you can filter and fix only the bad ones.

=IF(LEN(A2)>60,"Too long","OK")
  • LEN(A2) -> the character count of the title
  • >60 -> the platform's limit
  • "Too long" -> label when the limit is busted
  • "OK" -> label when the title fits
B2
fx
=IF(LEN(A2)>60,"Too long","OK")
ABC
1Product titleStatus
2Wireless mouseOK
3Premium ergonomic mechanical keyboard with RGB backlight and wrist restToo long
4USB-C hubOK
5Adjustable laptop stand for desk with cable management slotToo long
6HD webcamOK
7LED desk lamp with USB charging port and dimmable warm-cool lightToo long
8Cable manager kitOK
9Wireless headsetOK
Formula in cell B2. The IF wrapper turns the raw count into a status you can filter on.
Three titles bust the limit and need shortening. Filter the column for Too long and the work is right in front of you.
For more granular feedback, swap the second argument of IF for a number: =60-LEN(A2) tells you exactly how many characters over the limit each title runs.

LEN with TRIM: find rows with invisible whitespace

Data pasted from a website or exported from a legacy system often arrives with extra spaces at the start, end, or between words. The text looks fine on screen but breaks lookups silently.

Compare LEN(original) to LEN(TRIM(original)). When they differ, the cell has hidden whitespace.

=LEN(A2)-LEN(TRIM(A2))
  • LEN(A2) -> character count of the original cell
  • LEN(TRIM(A2)) -> character count after collapsing duplicate and leading/trailing spaces
  • Difference -> the number of bonus whitespace characters TRIM removed
  • 0 -> means the cell is clean. Anything above 0 means it needs trimming.
B2
fx
=LEN(A2)-LEN(TRIM(A2))
ABC
1Customer name (raw)Hidden chars
2Sarah Chen0
3 James Miller2
4Maria Santos1
5David Brown0
6Emma Davis 2
7Alex Kim0
8Carlos Gomez2
Formula in cell B2. A non-zero result means the customer name in column A has stealth whitespace.
Four names have invisible whitespace that would make exact-match lookups fail. Wrap the source column in TRIM, paste-special as values, and the issue disappears.

LEN inside text: build a progress message

Sometimes the right place for LEN is inside a longer string, building a message your colleagues can read at a glance. The & operator joins the count to surrounding text.

=LEN(A2)&" of 60 characters"
  • LEN(A2) -> the integer count
  • & -> joins the number to the text that follows
  • " of 60 characters" -> the literal suffix; mind the leading space
  • Result -> something like "47 of 60 characters" in plain text
B2
fx
=LEN(A2)&" of 60 characters"
ABC
1Product titleProgress
2Wireless mouse14 of 60 characters
3Mechanical keyboard with backlight33 of 60 characters
4USB-C hub9 of 60 characters
5Adjustable laptop stand with cable management46 of 60 characters
6LED desk lamp13 of 60 characters
7Cable manager kit17 of 60 characters
Formula in cell B2. Reads like a sentence in the cell.
Same LEN call, dressed up as readable copy. Anyone glancing at the column knows where each title sits relative to the cap.

Where people go wrong

  1. Forgetting that spaces count

    LEN counts every character including spaces, tabs, and line breaks. A name like 'Sarah Chen' returns 10, not 9. Off-by-one bugs creep in when authors expect only visible glyphs.

    Fix: Read the count as 'every keystroke', not 'every letter'. If you only want letters, use a SUMPRODUCT pattern or strip with SUBSTITUTE first.
  2. Comparing LEN of formatted and raw values

    LEN works on the underlying value, not what you see on screen. A cell formatted as $1,234.56 stores the number 1234.56, so LEN returns 7 (the digits and decimal point), not 9.

    Fix: Wrap the cell in TEXT() with the format string you want LEN to count: =LEN(TEXT(A2,"$#,##0.00")) returns the displayed length.
  3. Trying to LEN a whole range at once

    Writing =LEN(A:A) returns the length of the first cell only in classic Excel. Beginners expect a total or a list and get one number.

    Fix: Wrap in SUMPRODUCT for a total: =SUMPRODUCT(LEN(A2:A100)). In Excel 365 with dynamic arrays you can pass a range to LEN directly and it spills the results.
  4. Forgetting LENB exists

    LEN counts characters, but characters in non-Latin alphabets and emoji can take 2 or 4 bytes. If your downstream system limits by bytes (some legacy databases do), LEN gives the wrong answer.

    Fix: Use LENB instead. LEN counts what humans count; LENB counts what storage counts. Pick the one that matches the limit you're checking against.

Notes

  • LEN counts every character including spaces, line breaks, and tabs. There is no option to ignore whitespace.
  • Numbers are converted to text before counting. LEN(12345) returns 5. LEN(0.5) returns 3 because 0, ., and 5 are all characters.
  • An empty cell returns 0. A cell containing only a space returns 1.
  • LEN works on the underlying value, not the formatted display. A date like 5/3/2026 stored as a serial number returns 5 because the underlying value is 46145.
  • Wrap in TEXT() to count the formatted display: =LEN(TEXT(A2,"yyyy-mm-dd")) returns 10.
  • In Excel 365 LEN accepts a range directly and spills the results down or across.
  • For multi-byte character handling (Japanese, Chinese, emoji), use LENB which counts bytes instead of characters.

Now prove it

Reading about LEN is one thing.

Writing one in front of a 5,000-row product feed at 4:30pm with a launch deadline at 5pm is completely different.

These exercises put LEN in real workplace situations where the count actually matters.

Here's the thing about LEN.

On its own it looks trivial. Plug it into a workflow and it suddenly becomes the function that catches the bug nobody noticed: hidden whitespace, products that won't upload, names that fail to match.

That gap, between knowing what LEN does and using it as the sanity check before every workflow, is exactly what CellSkill is built to close.

Not with more reading.

With practice on scenarios that look like your actual job.

Start practicing LEN for free →
Free account . No credit card . Cancel anytime
Practice LEN
LEN in Excel: Count Characters in a Cell · CellSkill