Monday, February 20, 2017

Count characters in cells

Count characters in cells

When you need to count the characters in cells, use the LEN function. The function 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 and press Enter. In these examples, cell is the cell you want to count, such as B1.

  • To count the characters in more than one cell, enter the formula, and then drag the fill handle across or down the range of cells you want to use.

Entering mulitple LEN functions in a worksheet

  • To count a total number of characters in several cells, use the SUM functions along with LEN. For example, =SUM((LEN(cell1),LEN(cell2),(LEN(cell3)))). In this example, the LEN function counts the characters in each cell and the SUM function adds the counts.

Give it a try

Use the examples in the workbook below to see how to use the LEN function .

Copy the table below and paste into cell A1 in an Excel worksheet. Drag the formula from B2 to B3:B4 to see the length of the text in 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. On Sheet1 of this sample workbook, click cell B2.

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

The formula counts of the characters in cell A1, 45, and that number includes all spaces. If you have spaces after the final period, the formula also counts them.

Count characters in multiple cells

  1. In the sample workbook, click cell B2.

  2. In the cell, enter =LEN(A2).

  3. Press Ctrl+C to copy cell B2, and 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 (19, 26, 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 (90).

No comments:

Post a Comment