This array-entered formula in C2 then copied down gives the same results as you wanted, but that may be just luck. See attached file.
=MAX(IF(ISERROR(SEARCH($A$2:$A$52,D2)),FALSE,$B$2:$B$52))
(Array-Entering is pressing Ctrl+Shift+Enter rather than just Enter.)
p45cal Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.