Len Function to find a Mid?

53 views Asked by At

I am trying to pull out a piece of a string to no avail.

string = 90-8566-Doe-20140317_122627T-2_Update.pdf

I want to pull out the "Doe portion"

I have been using a Mid function with a Len function component and it just isn't coming out right.

2

There are 2 answers

0
ttaaoossuuuu On BEST ANSWER

Assuming first 8 characters are always the same:

=MID($A$1,9,FIND("-",$A$1,9)-9)

Or in VBA:

Range("A2") = Mid(Range("A1"), 9, InStr(9, Range("A1"), "-") - 9)
2
PugFugly On

Split the array by the hyphen character.

Then your value is the 3rd value in the array.