Extracting String between two types of characters

Sukhi

New member
Joined
Nov 9, 2018
Messages
1
Reaction score
0
Points
0
Location
New Delhi
Excel Version(s)
2010
Hello! Everyone

SBIPG NU6457493537 AMAZON MUMBAI--
SBIPG NU6457493532 AMAZON Tokyo--
SBIPG NU6457493535 AMAZON California--

I am looking for a formula which helps me extract the string between the two underlined character. Please note that I want the string between the last number from the left to right which can vary from "1-9" while this character"--" in the rightmost end is same for all the data entries.

Thanks in advance:rain:
 
In your example data, in each case the first character your wanting is position 19 in the start string. Does that apply to all of your data?
Or:
Is the first character always the second space in the start string?
 
As we haven't heard from you about the uniformity of your data, I thought I would post a solution anyway as others may find this useful. From the three sample main strings that you have provided, it does look
like the SB and the NU references are a consistent number of characters (i.e.18), so building this into the formula will start the extraction from character 19. If the data should have records where character 19
is not the second space then the formula may need to be changed. With those caveats try the following, assuming the main strings are from A2 down:

=MID(A2,FIND("$",SUBSTITUTE(A2," ","$",2)),(FIND("--",A2,1)-1)-FIND("$",SUBSTITUTE(A2," ","$",2))+1) Copied Down
 
Back
Top