No of characters in excel cell

Count characters in cells

Excel for Microsoft 365 Excel for the web Excel 2021 Excel 2019 Excel 2016 Excel 2013 More…Less

When you need to count the characters in cells, use the LEN function—which counts letters, numbers, characters, and all spaces. For example, the length of «It’s 98 degrees today, so I’ll go swimming» (excluding the quotes) is 42 characters—31 letters, 2 numbers, 8 spaces, a comma, and 2 apostrophes.

To use the function, enter =LEN(cell) in the formula bar, then press Enter on your keyboard.

Multiple cells: To apply the same formula to multiple cells, enter the formula in the first cell and then drag the fill handle down (or across) the range of cells.

Entering mulitple LEN functions in a worksheet

To get the a total count of all the characters in several cells is to use the SUM functions along with LEN. In this example, the LEN function counts the characters in each cell and the SUM function adds the counts:

=SUM((LEN(
cell1
),LEN(
cell2
),(LEN(
cell3
))
)).

Give it a try

Here are some examples that demonstrate how to use the LEN function.

Copy the table below and paste it into cell A1 in an Excel worksheet. Drag the formula from B2 to B4 to see the length of the text in all the cells in column A.

Text Strings

Formulas

The quick brown fox.

=LEN(A2)

The quick brown fox jumped.

The quick brown fox jumped over the lazy dog.

Count characters in one cell

  1. Click cell B2.

  2. Enter =LEN(A2).

The formula counts the characters in cell A2, which totals to 27—which includes all spaces and the period at the end of the sentence.

NOTE: LEN counts any spaces after the last character.

Count
characters in
multiple cells

  1. Click cell B2.

  2. Press Ctrl+C to copy cell B2, then select cells B3 and B4, and then press Ctrl+V to paste its formula into cells B3:B4.

This copies the formula to cells B3 and B4, and the function counts the characters in each cell (20, 27, and 45).

Count a total number of characters

  1. In the sample workbook, click cell B6.

  2. In the cell, enter =SUM(LEN(A2),LEN(A3),LEN(A4)) and press Enter.

This counts the characters in each of the three cells and totals them (92).

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

See all How-To Articles

This tutorial demonstrates how to set a character limit in Excel and Google Sheets.

set a character limit data validation final

Set a Character Limit

In Excel, the number of characters allowed in a single cell is 32767. However, you can set your own character limit for a text cell using data validation. Say you want to limit name length in cell B2 to 5 characters max.

  1. Select the cell or data range (here, cell B2) where you want to apply the data validation rule and in the Ribbon, go to Data > Data Validation.

set a character limit data validation

  1. In the Data Validation window, in the Settings tab, (1) choose Text length from the Allow drop down, then (2) select less than or equal to from the Data menu, and (3) enter a character limit for Maximum.

set a character limit data validation 2

  1. Now in the Error Alert tab, you can customize the error message that shows when entered text exceeds the character limit. (1) Enter a title for the message (Error) and (2) the message text (Name must have up to 5 characters). Then press OK.

set a character limit data validation 3

Now a data validation rule is created for cell B2. If you enter a name that is greater than 5 characters (for example Michael), the error message will appear.

set a character limit data validation final

Set a Character Limit in Google Sheets

To set a character limit in Google Sheets, use a custom formula (with the LEN Function) within data validation.

  1. Select the cell (here, B2) or data range where you want to apply the data validation rule, and in the Menu, go to Data > Data validation.

google sheets data validation

  1. In the Data validation window, (1) choose Custom formula is under the Criteria drop down, and (2) enter the formula:
=LEN(B2)<=5

Select (3) Reject input and (4) check Show validation help text. Now, (5) enter the error message text (Name must have up to 5 characters) and (6) click Save.

datavalidation gs len

As a result, if you enter a name longer than 5 characters (Michael), the created error message appears.

google sheets data validation 3

Содержание

  • Подсчет знаков
    • Способ 1: подсчет символов
    • Способ 2: подсчет символов в столбце
    • Способ 3: подсчет символов в нескольких ячейках с помощью автосуммы
    • Способ 4: подсчет символов в нескольких ячейках при помощи функции
  • Вопросы и ответы

Подсчет символов в ячейках в Microsoft Excel

Иногда наступает необходимость узнать, сколько символов содержится в конкретной ячейке. Конечно, можно просто подсчитать вручную, но что делать, если элементов много, а подсчет следует проводить с постоянно меняющимся содержимым для определенных целей? Давайте узнаем, как подсчитать количество знаков в Экселе.

Подсчет знаков

Для подсчета символов в Excel существует специальная функция, которая называется «ДЛСТР». Именно с её помощью можно просуммировать знаки в конкретном элементе листа. Существует несколько способов её использования.

Способ 1: подсчет символов

Для того, чтобы произвести подсчет всех знаков, расположенных в ячейке, используем функцию ДЛСТР, так сказать, в «чистом виде».

  1. Выделяем элемент листа, в котором должен будет выводиться результат подсчета. Кликаем на кнопку «Ввести функцию», расположенную в верхней части окна слева от строки формул.
  2. Переход в мастер функций в Microsoft Excel

  3. Запускается Мастер функций. Ищем в нем наименование ДЛСТР и жмем на кнопку «OK».
  4. Переход к функции ДЛСТР в Microsoft Excel

  5. Вслед за этим происходит открытие окна аргументов. Данная функция имеет только один аргумент – адрес конкретной ячейки. Причем нужно заметить, что в отличие от большинства других операторов, этот не поддерживает ввод ссылок на несколько ячеек или на массив. В поле «Текст» вводим вручную адрес элемента, в котором нужно подсчитать символы. Можно сделать по-другому, что будет проще для пользователей. Устанавливаем курсор в поле аргумента и просто кликаем по нужной области на листе. После этого её адрес появится в поле. Когда данные внесены, жмем на кнопку «OK».
  6. Аргументы функции ДЛСТР в Microsoft Excel

  7. Как видим, после этого результат расчета количества знаков выводится на экран.

Результат подсчета количества символов функцией ДЛСТР в Microsoft Excel

Способ 2: подсчет символов в столбце

Для того, чтобы подсчитать количество знаков в столбце или в любом другом диапазоне данных не обязательно прописывать формулу для каждой ячейки в отдельности.

  1. Становимся в нижний правый угол ячейки с формулой. Появляется маркер выделения. Зажимаем левую кнопку мыши и тянем его параллельно той области, в которой хотим подсчитать количество символов.
  2. Маркер выделения в Microsoft Excel

  3. Формула копируется на весь диапазон. Результат сразу же виден на листе.

Примменение автосуммы в Microsoft Excel

Урок: Как сделать автозаполнение в Excel

Способ 3: подсчет символов в нескольких ячейках с помощью автосуммы

Как было сказано выше, аргументом оператора ДЛСТР могут выступать только координаты одной ячейки. Но что делать, если нужно посчитать общую сумму символов в нескольких из них? Для этого очень удобно применить функцию автосуммы.

  1. Подсчитаем количество знаков для каждой отдельной ячейки, как это было описано в предыдущем варианте.
  2. Выделяем диапазон, в котором указано количество символов, и жмем на кнопку «Сумма», расположенную во вкладке «Главная» в блоке настроек «Редактирование».
  3. Примменение автосуммы в Microsoft Excel

  4. После этого общая сумма знаков во всех элементах будет отображена в отдельной ячейке рядом с диапазоном выделения.

Сумма символов всех ячеек в Microsoft Excel

Lumpics.ru

Урок: Как посчитать сумму в Экселе

Способ 4: подсчет символов в нескольких ячейках при помощи функции

В вышеуказанном способе нужно сразу провести расчет для каждого элемента отдельно и только потом подсчитать общую сумму знаков во всех ячейках. Но существует и такой вариант, в котором все расчеты будут проводиться в только одной из них. В этом случае нужно применять составную формулу с использованием оператора СУММ.

  1. Выделяем элемент листа, в который будет выводиться результат. Вводим в него формулу по шаблону:

    =СУММ(ДЛСТР(адрес_ячейки1);ДЛСТР(адрес_ячейки2);…)

  2. Функция СУММ в Microsoft Excel

  3. После того, как функция с адресами всех ячеек, количество символов в которых нужно подсчитать, введена, жмем на кнопку ENTER. На экран выводится общая сумма сложения знаков.

Рассчет суммы функцией символов СУММ в Microsoft Excel

Как видим, существует несколько способов подсчета количества символов в отдельных ячейках, так и общего числа знаков во всех элементах диапазона. В каждом из вариантов данная операция осуществляется при помощи функции ДЛСТР.

Еще статьи по данной теме:

Помогла ли Вам статья?

You are here

Count the number of characters in a cell in Excel

.

This lesson introduces the LEN() function, which allows you to calculate the number of characters in a cell. This formula is useful on its own, or can be combined with other text functions such as RIGHT(), LEFT(), MID() and FIND().

LEN() function syntax

The LEN() function has the following syntax:

=LEN(text)

  • Where text is the text value for which you want to calculate the number of characters, or a reference to a cell that contains a text value.
  • Note that the LEN() function will count the number of characters in a cell regardless of whether the value in that cell is text or a number, or a combination of both.

Example of the LEN() function in action

To use the LEN() function, follow these steps:

  • You can use the LEN() function to calculate the length of values in a column of cells. This example also uses the AVERAGE(), MAX() and MIN() functions:
    Example of the LEN() function in Excel

.

Want to learn more? Try these lessons:

.

.

Our Comment Policy.

We welcome your comments and questions about this lesson. We don’t welcome spam. Our readers get a lot of value out of the comments and answers on our lessons and spam hurts that experience. Our spam filter is pretty good at stopping bots from posting spam, and our admins are quick to delete spam that does get through. We know that bots don’t read messages like this, but there are people out there who manually post spam. I repeat — we delete all spam, and if we see repeated posts from a given IP address, we’ll block the IP address. So don’t waste your time, or ours. One other point to note — if you post a link in your comment, it will automatically be deleted.

Add a comment to this lesson

.

.

.

.

A reader posed an interesting conversion problem between an old database and a new online one. She wanted to use an Excel file to move the data from one system to another. However, the new system would not accept field values longer than a certain number of characters. In this tutorial, I’ll show how to check the character count in Excel using the LEN function.

Using the LEN Function

In another tutorial, we used LEN in conjunction with TRIM and the SUBSTITUTE function to count the number of words in a cell. But, in this case, we need to spot cell items that are too long. Fortunately, the reader had already split the first and last names so we didn’t have to deal with multiple columns.

The LEN function returns the number of characters for a given cell. This also counts spaces. You could then use Excel’s conditional formatting to color-code entries that exceed the field length specified in the record layout. Of course, you could also sort on the length column as well.

Instead of showing the company’s information, I’ll use some test names and addresses.

Find Character Count with LEN,

  1. Open your Excel file.
  2. Insert a column to the right of the field you wish to count.
  3. Enter a descriptive label for the column. For example, I used Dcount since I want to count the characters.
  4. Place your cursor in the first cell under that column label. In my example, it’s D2.
  5. From the Formulas tab, click Insert Function…
  6. In the Insert Function dialog, select the category of All.
  7. Select the LEN function from the list. (Tip: you can press L to advance the list.)

Insert Function dialog with LEN in search field.

Finding and inserting the LEN function
  1. Click OK. The Functions Arguments dialog should appear.
  2. Click in the spreadsheet cell you wish to count characters. The value should carry over to the Function Arguments dialog. In my example, it would be C2. You can also see the Excel formula result in the red outlined area below.

Function Arguments dialog with cell C2 in Text field.

Adding the function argument of cell C2
  1. Click OK.

Excel should show a number in that Dcount cell, which is your character count. Most likely, you will want to copy this formula to other cells in the same column.

To copy the LEN formula to other cells in the column.

  1. Place your cursor in the first cell with the LEN formula.
  2. Scroll down with your mouse and Shift + click in the last cell in your column
  3. Press Ctrl+ d.

At this point, I know the character count for the Address1 field. After that, I could either use Excel’s conditional formatting to color-code entries above a certain value or sort using Dcount column values. The last step is to fix the records that are too large and delete your Dcount column if you’re importing to another system.

As I mentioned above, this function also counts spaces. Often we tend to think of normal spaces between words. However, the LEN function will also count leading and trailing spaces. While it’s easy to see leading spaces because they stand out, it can be tricky with trailing spaces. Trailing spaces are blank characters added to the end of your entry that you can’t see.

If you look at the screen snap below, you’ll see that the address for B3 looks longer than C2, and yet the Dcount values are quite different. That’s because I added a bunch of trailing spaces at the end. Granted, I added many spaces to make a point, but it’s easy for a single space to get added. Don’t worry. Excel has a TRIM function to fix this.

LEN function counting trailing spaces on address.

Example of trailing spaces being counted

Troubleshooting

There are many reasons for Excel formula errors, but there are other issues as to why the LEN function doesn’t work.

  1. The cell with your LEN formula is formatted as text. If so, try changing it to general or number. You will probably have to re-enter the formula.
  2. You may need to turn on Automatic calculations.

We often think of Microsoft Excel just as a number-crunching program. However, with the program’s built-in functions such as LEN, you can use it to solve some interesting problems aside from counting characters in a cell. For example, it can be a great intermediary tool for spotting problem records or converting data. And once you get familiar, you can skip using Insert Function and type directly into the formula bar.

Hand-picked Excel Tutorials

  • How to Use XLOOKUP in Excel
  • Learning the Excel Macro Editor
  • How to Use Excel Solver

Понравилась статья? Поделить с друзьями:
  • Nicer word for nice
  • No negatives in excel
  • Nicer word for lazy
  • No more word needed
  • Nice words word search