Home >Topics >excel >The difference between excel functions lenb and len

The difference between excel functions lenb and len

藏色散人
藏色散人Original
2019-06-04 14:12:4510599browse

The len and lenb functions are both used to count the number of characters in a cell, so what is the difference between them? This article will explain in detail the meaning, syntax and examples of these two functions.

The difference between excel functions lenb and len

The difference between excel functions lenb and len is used:

1.LEN function means return The number of characters in the text string, and the syntax is relatively simple, which is LEN(text)

The difference between excel functions lenb and len

The difference between excel functions lenb and len

2.LENB function# The meaning of ## is to return the number of characters contained in the text, and the syntax is relatively simple, that is, LENB(text)

The difference between excel functions lenb and len

The difference between excel functions lenb and len

From the meaning Maybe you don’t understand it clearly. Let me explain the main difference between them.

LEN is counted by the number of characters. Whether it is Chinese characters or numbers, it is counted by 1. LENB is counted by the number of bytes. of. Numbers, letters, English, and punctuation marks entered in half-width state are calculated as 1, and punctuation marks entered in Chinese characters and full-width state are calculated as 2.

The following will give an example to explain in detail

As shown in the figure, the main difference between Example 1 and Example 2 is that the comma in Example 1 is entered in the full-width state, while the comma in Example 2 is The comma is entered in the half-width state (that is, in the English state)

The difference between excel functions lenb and len

Now we use len to count the number of characters in Example 1 and Example 2, as shown in the figure. You will find that the obtained values ​​​​are all 6, that is, regardless of the Chinese character numbers and punctuation, they are counted as 1

The difference between excel functions lenb and len

Now we use lenb to count the number of characters in Example 1 and Example 2. , as shown in the figure, you will find that the obtained values ​​are different, Example 1 is 9, Example 2 is 8, because Chinese characters are pressed by 2 characters, numbers are pressed by 1, and the comma in Example 1 is in the full-width state (Chinese state) If entered below, it should be counted as 2. The comma in Example 2 is input in half-width state (English state), so it should be counted as 1, so Example 1 has 1 more byte than Example 2

The difference between excel functions lenb and len

Finally, we can calculate the number of characters and bytes of 1;' in the question. The input in the question is full-width. Using len should get 4, and using lenb should get the number of bytes. It's 2(中) 1(1) 2(;) 2(')=7, are you doing it right?

This article comes from the EXCEL basic tutorial column:

http://www.php.cn/topic/excel/

The above is the detailed content of The difference between excel functions lenb and len. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:excel color fillNext article:excel color fill