If you hope to extract "0129" from "AXB1234_CBS0129", =MID(str,XMATCH(TRUE,ISERROR(--MID(str,SEQUENCE(LEN(str)),1)),,-1)+1,999) enter image description here