Excel text handling functions

1. The case, full-width half-width conversion function

1.1 lowercase letters transfer function

LOWER function: all letters to lowercase
UPPER function: Converts all letters to uppercase letters
PROPER function: to convert the first letter of the word to uppercase
Case conversion function Case

1.2 full-width half-width conversion function

Full-width characters refers to a character occupies two standard character position of the character, also known as double-byte characters. All the characters are double-byte characters. Refers to a half-size character is a character standard character occupies character, also known as single-byte characters.

LEN function: for any single character are calculated according to a length.
LENB function: For any single press of a single-byte character length calculating, any two single-byte character calculated length.
Case
ASC functions: to convert full-width half-width characters.
ASC function
WIDECHAR function: half character to convert full-width characters.
WIDECHAR function

2. The character encoding conversion functions

CODE and CHAR function commonly used functions and character encoding conversion process

CODE function returns a text string of the digital codes of the first character, the return code corresponding to the character set used by the machine.
The CHAR function can be native character set, the code specified by the returned numeric characters.
CODE and CHAR function test
Note: Use the character encoding CODE function achieved and then the CHAR function can not be completely converted to the original characters. In the blank cells hold down the alt + enter 178 ² symbols can be tested but due to my own computer is a MAC so I used the second approach
Here Insert Picture Description
Case 1: Generate a sequence of numbers and letters generated sequences
Here Insert Picture Description
Case 2: Name Telephone branches merge
Here Insert Picture Description
UNICHAR function: to return referenced by the specified value of UNICODE characters.
UNICODE function: Returns the value of UNICODE text content of the first character.

3. The character string extraction function

= The LEFT (text, [num_chars])
= RIGHT (text, [num_chars])
= the MID (text, start_num is, num_chars)
= LEFTB (text, [num_bytes])
= RIGHTB (text, [num_bytes])
= MIDB (text, start_num, num_bytes)
Note: Chinese characters and full-width characters are all double-byte character! Parameter Description:

Text 必需。包含要提取的字符的文本字符串。
Num_chars 可选。指定要由函数中提取的字符的数量。Num_chars 必须大于或等于零。如
果num_chars大于文本长度,则返回全部文本。 如果省略num_chars,则假设其值为 1。 
Start_num 必需。文本中要提取的第一个字符的位置。文本中第一个字符的 start_num为1
依此类推。
Num_bytes 可选。按字节指定要由提取的字符的数量。
注意: MID函数以及MIDB函数所有的参数都是必须的

Case 1: According to specified requirements related to the interception of character
Here Insert Picture Description
Case 2: Item C is the beginning of the beginning of the shirt W is beginning to coat the other letters Other
Here Insert Picture Description
Case 3: lottery numbers extracted
Here Insert Picture Description
Case 4: recall names and phone
Here Insert Picture Description
Case 5: collection of payments
Here Insert Picture Description

4. Find function characters

1, FIND (find_text, within_text, [start_num]) Parameters:

Find_text  必需。要查找的文本。
Within_text  必需。包含要查找文本的文本。
Start_num 可选。指定要从其开始搜索的字符。within_text 中的首字符是编号为1的字符
如果省略 start_num,则假设其值为 1。

2, SEARCH (search_text, within_text, [start_num]) Parameters:

search_text  必需。要查找的文本。
within_text  必需。要在其中搜索 find_text 参数的值的文本。
start_num  可选。within_text 参数中从之开始搜索的字符编号。

effect:

FIND函数与SEARCH函数都是用于定位某一个字符(串)在指定字符串中的起始位置,返回的
结果是数字。如果在同一字符串中存在多个被查找的子字符串,函数只返回从左往右
方向第一次出现的位置。如果查找字符(串)在源字符串中不存在,则返回错误值#VALUE!。

the difference:

FIND函数区分大小写,并且不允许使用通配符。而SEARCH函数不区分大小写,但是允许在
参数中使用通配符。

When it is necessary to distinguish between double-byte character process, you can use the following two functions, the two functions are
according to a double-character two position calculation.
. 3, FINDB (for find_text, of within_text, [start_num is])
. 4, SEARCHB (SEARCH_TEXT, of within_text, [start_num is])

Case 1: Get mailbox extension
Here Insert Picture Description
Case 2: The winning numbers
Here Insert Picture Description
Case 3: extract phone numbers
Here Insert Picture Description
Case 4: The brands and models of each cell in Chinese characters removed
Here Insert Picture Description

5. Replace function or character string

1, SUBSTITUTE (text, old_text, new_text, [instance_num]) Parameters:

第一个参数是需要替换其中字符的文本或是单元格引用。
第二参数是需要替换的文本。
第三参数是用于替换的文本。
第四个参数可选,是指定要替换第几次出现的旧字符串。注意:
1.区分大小写和全角半角字符。
2.当第三参数为空文本或是省略该参数的值而仅保留参数之前的逗号时,相当于将需要替换
的文本删除。
3.当第四个参数省略时,源字符串中的所有与参数old_text相同的文本都将被替换。如果第
四参数指定为2,则只有第2次出现的时候才会被替换。

Here Insert Picture Description
Case 1: Calculation tie points
Here Insert Picture Description
Case 2: Remove fill bit value 0
Here Insert Picture Description
Case 3: counting the number of the terminal
Here Insert Picture Description
2, REPLACE (old_text, start_num, num_chars, new_text) Parameters:

第一个参数,表示要替换其部分字符的源文本。
第二个参数,指定源文本中要替换为新字符的位置。
第三个参数,表示希望使用新字符串替换源字符串中的字符数,如果该参数为0,或省略参数
值可以实现插入功能。
第四个参数,表示将要替换源文本中字符的文本。

Case 1: Hide winners phone
Here Insert Picture Description
Case 2: the first letter into a capital sentence
Here Insert Picture Description
Case 3: Add a name Tel words
Here Insert Picture Description

6. Repeat function characters

REPT (text, number_times) Parameters:

参数1:text表示重复出现的文本
参数2:number_times表示指定文本重复出现的次数

Case 1: indicates how many shipments with a progress bar style?
Here Insert Picture Description
Case 2: The fraction hotel rating
Here Insert Picture Description
Case 3: The first number in a "-" before the letter substitutions as: "the Y"
Here Insert Picture Description
Case 4: The fraction of star rating.
Here Insert Picture Description

7. remove spaces and non-printable characters function

TRIM function: to clear the text in all spaces in addition to a single space between words.
Case 1: Take the last "-" after the contents of
Here Insert Picture Description
the CLEAN function: text in ASCII code value of non-printing characters can be cleared 0-31.
Case 2: summing
Here Insert Picture Description

8. The non-standard digital conversion function

VALUE function: date may be converted to a number sequence, digital text is converted to digital values, converted into full-width half-width digital numbers or the like.
NUMBERVALUE function: VALUE function upgrade, it can handle mixed numerical and symbolic space of chaos and other special circumstances.
Here Insert Picture Description

9. formatted text function

= TEXT (value, format_text) Parameters:

参数1:要格式化的内容。既可以是数值型数字,也可以是文本型数字。
参数2:指定格式代码。与单元格数字格式中的大部份代码基本相同。

Format Code Format distinction code in cell numbers in the TEXT function:

1、Text函数无法使用星号(*)来实现重复某个字符以填满单元格。也不能使用某种颜色实现
显示效果。如=TEXT(-9.99,"0.00;[红色]-0.00;0")
2、设置单元格的格式,仅仅是数字显示外观的改变,其实质仍然是数值本身,不能影响进一
步的汇总计算,即得到的是显示效果。
3、使用TEXT函数可以将数值转换为带格式的文本,其实质已经是文本,不再具有数值的特性
即得到的是实际的效果。

TEXT function code format is similar to the custom format code, the code format TEXT function is also divided into four conditions segments, each segment with a semicolon between intervals, but in actual use, the condition may be partially omitted section. grammar:

[条件1];[条件2];[不符合条件1和条件2];[文本]

Case 1:
Here Insert Picture Description
Case 2:
Here Insert Picture Description
Case 3:
Here Insert Picture Description
Case 4:
Here Insert Picture Description
Case 5:

=SUBSTITUTE(SUBSTITUTE(IF(-RMB(A4,2),TEXT(A4,";负")
&TEXT(INT(ABS(A4)+0.5%),"[dbnum2]G/通用格式元;;")
&TEXT(RIGHT(RMB(A4,2),2),"[dbnum2]0角0分;;整"),),"零角",
IF(A4^2<1,,"零")),"零分","整")

Here Insert Picture Description
Case 6: calculated based on the age of ID card
Here Insert Picture Description

10. A cell function information

= CELL (info_type, [reference]) Parameters:

参数1:指定要返回的单元格信息的类型。需要用半角双引号引起来。
参数2:引用需要得到其相关信息的单元格地址。如果省略,则将info_type参数中指定的信
息返回给最后更改的单元格,如果参数reference是某一单元格区域,cell函数只将该信息
返回给该区域左上角的单元格。

Info_type parameter values:

address:返回单元格地址
col:返回单元格的列标。
row:返回单元格的行号。
width:返回取整后的单元格的列宽。
color:如果单元格中的负值以不同颜色显示,返回1 否则返回0。
contents:返回左上角单元格的值。
filename:返回包含引用文件名(包括路径)。如果包含目标引用的工作表没有保存,则返
回空文本。
format:返回表示单元格中数字格式的字符代码。
parentheses:如果单元格使用了自定义格式,并且格式代码中包含括号"()",返回1否则返
回0。
prefix:返回单示单元格文本对齐方式的字符代码。
protect:如果单元格没有锁定,返回0;如果单元锁定,则返回1。
type:返回表示单元格中数据类型的字符代码。

Obtaining cell formatting a digital codes (important):
Here Insert Picture Description
obtaining cell formatting digital codes bis (important):
Here Insert Picture Description
Case: Get the name of the worksheet with cell function
Here Insert Picture Description

11. The cell input format restrictions

Knowledge points to explain the following:

Excel limiting cell input format


Example: Enter the date specified format
Here Insert Picture Description

Released eight original articles · won praise 210 · views 10000 +

Guess you like

Origin blog.csdn.net/xw1680/article/details/104099315