I need an excel formula to find the text between the last two underscores in an excel cell:
i.e.
AAA_BBB_CCC_DDDD_E => DDDD
AAA_BBB_CCC_DDD_EEE_E => EEE
AAA_BBB_CCC_DDD_EEE_F_ => F
AAA_BBB_CCC_DDD_EE_GGGGGGGGGG => EE
AAA_BBB_CCC_DDD_EEE_FFF_GGGGGGGGGGGG_H => GGGGGGGGGGGG
The formula i got is based on the last index of:
EXCEL LAST INDEX OF
=RIGHT(LEFT(A2,SEARCH("@",SUBSTITUTE(A2,"_","@",LEN(A2)-LEN(SUBSTITUTE(A2,"_",""))))-1),LEN(LEFT(A2,SEARCH("@",SUBSTITUTE(A2,"_","@",LEN(A2)-LEN(SUBSTITUTE(A2,"_",""))))-1))-SEARCH("@",SUBSTITUTE(LEFT(A2,SEARCH("@",SUBSTITUTE(A2,"_","@",LEN(A2)-LEN(SUBSTITUTE(A2,"_",""))))-1),"_","@",LEN(LEFT(A2,SEARCH("@",SUBSTITUTE(A2,"_","@",LEN(A2)-LEN(SUBSTITUTE(A2,"_",""))))-1))-LEN(SUBSTITUTE(LEFT(A2,SEARCH("@",SUBSTITUTE(A2,"_","@",LEN(A2)-LEN(SUBSTITUTE(A2,"_",""))))-1),"_","")))))
I need to make this less complicated, any ideas?
Try this
Note, if any of the segments could be longer than 50 characters, increase the 100 and 200 figures accordingly