Recognising certain part of text then giving corresponding answer

I a have with variable text in it and I would like to search that cell and recognise if two letters are at the end of a number text sequence. If it is I want to give a certain word as a result and if not give the default answer:

In the first cell might be 123-01TM
In the second cell I have a choice of two answers, for example "Tim" if "TM" is at the end or "John" if "TM is not present

123-01TM TIM
123-02 JOHN
123-03TM TIM
123-04 JOHN
123-05 JOHN
123-06TM TIM

Hope thats makes sense

Thanks

Nick's picture

if the data starts in

if the data starts in A1
enter this formula in B1:
=if(right(a1,2)="TM","TIM","JOHN")

you can then copy this formula down

Awesome, that's perfect

Awesome, that's perfect thanks mate!