Please consider supporting this website by buying me a coffee.
Thank you for your consideration!

Updated | November 9, 2024

Extract the Numeric Characters from a Text String

Extract the Numeric Characters from a Text String

The following formula extracts the numeric characters from the text string in B3...

=TEXTJOIN("",TRUE,IFERROR(MID(B3,SEQUENCE(LEN(B3)),1)+0,""))

For earlier versions of Excel...

=TEXT(SUM(MID(0&B3,LARGE(IF(ISNUMBER(MID(B3,ROW(INDIRECT("1:"&LEN(B3))),1)+0), ROW(INDIRECT("1:"&LEN(B3))),0),ROW(INDIRECT("1:"&LEN(B3))))+1,1)* 10^ROW(INDIRECT("1:"&LEN(B3)))/10),REPT(0,SUM(IF(ISNUMBER(MID(B3, ROW(INDIRECT("1:"&LEN(B3))),1)+0),1))))

Note that the formula needs to be confirmed with CTRL+SHIFT+ENTER. If done correctly, Excel will automatically place curly braces {...} around the formula.

Based on the sample data, the formula returns "08625".

Sample Workbook: Download