You're welcome.

This is the meat of the formula
LOOKUP(2,1/ISNUMBER(SEARCH(B2,$A$19:$A$24)),$A$19:$A$24)

That returns the whole string from A19:A24 based on matching the value from B.

The rest is just a bunch of string manipulation using replace, left, Trim and Substitute.

The 51 was hardcoded based on the string always beginning with the same 51 character string.