The UDF to use.
The default separator is "_", but you can specify any other separator character
The default piece is the 2nd last (index = -2), but you can ask for any other position
Function extract(word As String, Optional separator As String = "_", Optional ByVal index As Long = -2)
' index = 1 gives first word, 2 gives 2nd word...
' index -1 gives last word, -2 gives 2nd last word...
Dim tokens() As String
tokens = Split(word, separator)
If index < 0 Then index = UBound(tokens) + index + 1 Else index = index - 1
If index >= 0 And index <= UBound(tokens) Then extract = tokens(index)
End Function
Just use a formula like =Extract(B2) in Excel