Find the location of a particular character string of the last occurrence of

C # -like str.LastIndexOf ()

There cell A1

12345#78#abc#ef

Finally, a # number position in the string:

1. First, there are several statistical A1 #

# Replace the null, then the new string length minus the original length of the string, i.e. the number #

If you are looking for more than a string of characters, is divided by a long string

  =LEN(A1)-LEN(SUBSTITUTE(A1,"#",""))

2. The original string in the last # with a special symbol, such as @ replaced.

@ Needs is A1 has never seen before

  =SUBSTITUTE(A1,"#","@",LEN(A1)-LEN(SUBSTITUTE(A1,"#","")))

  SUBSTITUTE third parameter is the number of A1, @ # replaced,

  The last # is the number of a total number of #

At this point A1, says:

  12345#78#abc@ef

3. Find @ again to the position of a value of 13.

  =FIND("@",SUBSTITUTE(A1,"#","@",LEN(A1)-LEN(SUBSTITUTE(A1,"#",""))))

 

 

Guess you like

Origin www.cnblogs.com/sinceret/p/11771175.html