To handle the possibility of .rib being .RIB, .Rib, .rIB etc. etc. youcan use the UPPER function thus:=MID(A2,FIND("SMTP:",A2),FIND(".RIB",UPPER(A2))-FIND("SMTP:",A2)+4)