Will excel the address of a cell in the table are extracted from a certain part of the first written on my cell:
=the IF (ISERROR (FIND (huangcun, i2)), the IF (ISERROR (FIND (" west red gate ", i2)), and 0, "west red gate"), "huangcun town")
But nested too much more than a certain number of error, so we have to customize a function at such a function to "Beijing's daxing district huangcun town village, sun village south 500 meters" in the "huangcun town" extracted (to huangcun town ", "more than a dozen such keywords, you can write to death), there should be a switch in other programming languages case statement don't know if the VBA, method of how to write and how network by value
CodePudding user response:
And not have broken words, where use Case branch,And you search ( huangcun ) and return (huangcun town ) keywords is different also, small using If branch,
Function GetKeyWord (ByVal s As String) As String
Dim sKeyWord As String
If InStr (1 s, huangcun ") Then
SKeyWord="huangcun town"
ElseIf InStr (1 s, "west red gate") Then
SKeyWord="west red door"
The Else
SKeyWord="0"
End the If
GetKeyWord=sKeyWord
End the Function
CodePudding user response:
s="Beijing's daxing district huangcun town village, sun village south 500 meters" :? Mid (s, Instr (s, "area") + 1, Instr (s, "town") - Instr (s, "area"))
CodePudding user response: