That's quite handy.
Thanks!
Jesse
If you filled cells will always have at least one underline, then you can use this...Hi,
how does it work with underlines in a string and with a different string length?
Examples:
nO_m10m_p10
nO_Unit_uNite2_m0m_p10
nO_uNite2_0_p10
nO_Unit_uNite2_-273,14_p10
The expected result should be like that:
m10m
m0m
0
-273,14
I would prefer an excel functions instead of a VBA script.
If you filled cells will always have at least one underline, then you can use this...
=TRIM(LEFT(RIGHT(SUBSTITUTE(A1,"_",REPT(" ",100)),200),100))
If some of your filled cells might not have an underline (so there is not next-to-last "field"), then it depends on if you want the text returned (even though it is not the next-to-last word) or if you want a blank returned. If you want the word returned, then use the above formula, but if you want a blank returned, then use this formula instead...
=TRIM(LEFT(RIGHT(SUBSTITUTE("_"&A1,"_",REPT(" ",100)),200),100))
Give this a try:
=IFERROR(MID(A1,FIND("_",A1,FIND("_",A1)+1)+1,1)*8,"")
or, if you do not have Iferror function:
=MID(A1,FIND("_",A1,FIND("_",A1)+1)+1,1)*8