In daily operations, we often need to process Excel data containing personal information, in which name information needs to be sensitized. PHP editor Xigua today will introduce a simple method using the Excel replace function to help you easily replace name information with anonymous characters.
1. Organize the original excel list information, such as name information or bank card number information.
2. Our requirement is to process the name column in excel so that only the first character of the name is retained, and all subsequent names are replaced with *, so in C2 Enter =REPLACE(B19,2,2,"**") in the cell, and the replacement result displays Li**. Double-click the lower right corner of C2 and all values in column B will be replaced.
#3. If you don’t want to display ** when the name has two characters, you can simply optimize the function and simply distinguish between three characters and two characters. . =IF(LEN(B2)=3,REPLACE(B2,2,2,"**"),REPLACE(B2,2,1,"*")).
4. At this point, my needs are perfectly solved through the replace function. In addition, the usage of the replace function is as follows:
REPLACE(parameter 1, parameter 2, parameter 3 ,Parameter 4)
Parameter 1 is the text whose characters are to be replaced.
Parameter 2 is the starting position of the characters in parameter 1 to be replaced with parameter 4.
Parameter 3 is the character that REPLACE wants REPLACE to use parameter 4 to replace the characters in parameter 1 starting from parameter 2 number.
Parameter 4 is the text to be used to replace the characters in parameter 1.
For example: =REPLACE(A3,3,2,"zifu") Use zifu to replace the 2 characters starting from the 3rd digit of A3.
The above is the detailed content of The specific method of using Excel's replace function to sensitize people's names. For more information, please follow other related articles on the PHP Chinese website!