How to Use LEN Function in Excel: A Quick and Simple Guide

November 9, 2023 280 views

The LEN function in Excel can be used to return the number of characters in a text string. However, it can be confusing to use correctly, especially when dealing with complex text strings. This article will provide you with a step-by-step guide on how to master the LEN function in Excel.

What is the Len Function in Excel?

The LEN function in Excel is your trusty tool for counting characters in a text string. It's your go-to for tallying up letters, numbers, special characters, non-printable characters, and even those seemingly invisible spaces lurking in your Excel cell. In essence, the LEN function provides you with the length of text in an Excel cell.


Measure text length effortlessly.

Return Value:

The number of characters in the text.


text: The text you want to measure.



How to Use LEN Function in Excel (Step-by-Step)

The LEN function in Excel is a powerful tool for text analysis, especially in tasks like pricing analysis. Follow these simple steps to make the most of it:

Step 1: Select the Cell

Choose the cell where you want to see the result of your text analysis.

Step 2: Enter the Formula

In the selected cell, type =LEN(text), replacing 'text' with either the cell reference or the specific text string you want to analyze.

Step 3: Calculate

Press the Enter key to execute the formula, and watch as Excel calculates the length of your chosen text string.

Practical Examples for Better Comprehension

Step 1 Select a cell where you want to display the character count. Let's say you choose cell B2.

Step 2 In the formula bar, type "=LEN(A2)" and press Enter.

Step 3 Excel will count the characters in cell A2 and display the result in cell B2. For instance, if cell A2 contains "Hello, World!", cell B2 will show "13" because there are 13 characters in the text, including letters, punctuation, and spaces.

Recommend WPS Spreadsheet
  • Use Word, Excel, and PPT for FREE, No Ads.

  • Same Excel Formula as Microsoft. Perfectly compatible with MS format.

  • Microsoft-like interface. Easy to learn. 100% Compatibility.

  • Boost your professional productivity by 10x with WPS's abundant free Excel templates.

5,820,008 User
Algirdas Jasaitis

Combine LEN Function with Other String Functions in Excel

The LEN function in Excel is often used in tandem with various other string functions to manipulate and extract specific elements from text strings. Let's explore some common text functions that work well with LEN and understand their purposes:




Return Value



Get the number of characters in a text string

Number of characters



Remove leading and trailing spaces

Text without spaces


SUBSTITUTE(text, old, new)

Replace specified text in a string

Text with substitutions


LEFT(text, num_chars)

Extract leftmost characters

Leftmost characters


RIGHT(text, num_chars)

Extract rightmost characters

Rightmost characters


MID(text, start_num, num_chars)

Extract middle characters

Middle characters


SEARCH(find, within, [start])

Find position of specified text

Position of text


For example, if you have the text "Happy anniversary!" in cell A1, which has a space before and after the text, using =LEN(A1) would return a value of 20. This count of 20 includes the extra spaces.

To ensure an accurate character count and eliminate extra spaces, you can nest the TRIM and LEN functions. TRIM is specifically designed to remove all spaces from a text string except for those between words. By placing the TRIM formula as an argument within the LEN function, Excel counts the number of characters in the trimmed string.

The formula =LEN(TRIM(A1)) will correctly count the characters in the text "Happy anniversary!" as 18, taking into account only the actual characters and not the spaces

Free Office Suite for Word, Excel, PowerPoint ——WPS Office

WPS Office, your all-in-one office tool suite. It is a modernized powerful office tool Apps that includes Writer, Spreadsheets, Presentation, and PDF. It supports both PC and Mobile, and is compatible with Microsoft Office, Google Docs and Adobe PDF. Whether you're on your PC or mobile device, WPS Office offers a seamless and efficient solution5. Join the millions already benefiting from WPS Office.

We recommend that you download and use WPS Office for the following reasons:

  • Affordable: WPS Office is budget-friendly.

  • Compatibility: It works well with Microsoft Office files.

  • Feature-rich: It offers a wide range of tools and functions.

  • Price: WPS Office offers a free version.

  • User-friendly: It has an easy-to-use interface.

Download the latest version ( online today and supercharge your productivity!

To download WPS Office, follow these steps:

Step 1 Go to the WPS Office website.

Step 2 Click on the " Free Download" button.

Step 3 Follow the on-screen instructions to complete the download.


1. What does Len () return?

The LEN() function, when applied in Excel, returns the count of characters within a specified text string. It's a valuable tool for measuring the length or size of textual data.

2. What is Len in the formula field?

In a formula field, LEN(text) is used to calculate the length (number of characters) of a specified text or data field. For instance, LEN(Product Code) returns the character count of a Product Code field.


In summary, the LEN function in Excel is a vital tool for character counting in text strings. This comprehensive guide has covered its purpose, usage, and practical examples. It has also highlighted the synergy of the LEN function with other string functions for more advanced text manipulation.

Now, let's give a shoutout to WPS Office. WPS Office is a modern and robust office suite featuring Writer, Spreadsheets, Presentation, and PDF tools. It's your go-to solution for creating documents, crunching data, and managing PDFs efficiently. Whether you're working on your PC or mobile device, WPS Office ensures a smooth and productive experience.

15 years of office industry experience, tech lover and copywriter. Follow me for product reviews, comparisons, and recommendations for new apps and software.