We're using this formula to extract info from between the first and third occurrence of a dash, but it relies on the extracted info being a fixed length:
=IF(K2="Other","Other",IF(LEN(A2)<12,MID(A2,FIND("-",A2)+1,LEN(A2)-4),IF(LEN(A2)-LEN(SUBSTITUTE(A2,"-",""))>2,TRIM(MID(SUBSTITUTE(SUBSTITUTE(A2,"-",REPT(" ",255),3),"-",REPT(" ",255),1),255,255)),"")))
This works well because we used to have a fixed length between 1st and 3rd dash, but now the text is variable and we need a formula to work regardless of the length of the middle section.
Also, if there is no 3rd dash, we want to just extract the info from the first dash to the end of the string.
How do I convert this formula so it works regardless of the length of the text between the dashes?
=IF(K2="Other","Other",IF(LEN(A2)<12,MID(A2,FIND("-",A2)+1,LEN(A2)-4),IF(LEN(A2)-LEN(SUBSTITUTE(A2,"-",""))>2,TRIM(MID(SUBSTITUTE(SUBSTITUTE(A2,"-",REPT(" ",255),3),"-",REPT(" ",255),1),255,255)),"")))
This works well because we used to have a fixed length between 1st and 3rd dash, but now the text is variable and we need a formula to work regardless of the length of the middle section.
Also, if there is no 3rd dash, we want to just extract the info from the first dash to the end of the string.
How do I convert this formula so it works regardless of the length of the text between the dashes?