Get Nth Word

Cell A1 is string, Cell B1 is nth value (for the first word in A1, B1 = 1 etc)

=IF(B1>LEN(A1)-LEN(SUBSTITUTE(A1," ","")),RIGHT(A1,LEN(A1)-FIND("^^",SUBSTITUTE(A1," ","^^",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))),IF(B1=1,MID(A1,1,FIND("^^",SUBSTITUTE(A1," ","^^",1))-1),MID(A1,FIND("^^",SUBSTITUTE(A1," ","^^",B1-1))+1,FIND("^^",SUBSTITUTE(A1," ","^^",B1))-FIND("^^",SUBSTITUTE(A1," ","^^",B1-1))-1)))



© Copyright andrewsexceltips.net All Rights Reserved.