How to extract only the digits from an Excel cell containing numbers and letters. To do that, we will use the new Excel functions: FILTER and SEQUENCE.

What is the logic used to do the job?
To extract only the number from an Excel cell, we must split each character and keep the numbers.
- This work is made possible thanks to the new SEQUENCE function and the STXT function.
- Next, we will perform a test to find out if each of these characters is a number or not.
- Finally, when the test is true, we keep only the numbers.
Step 1: Extract each character from the cell
The MID function allows you to extract a sub-part of a character string. Associated with the SEQUENCE function, you create an array in which each cell will represent one of the characters in the cell.
=MID(A2,SEQUENCE(,LEN(A2)),1)



Step 2: Test to know if the content is a number or not
Next, we need to perform a test on each of the cells to find out if the content is numeric or not.
So, of course, here, using the ISNUMBER function seems logical. However, at this stage, each of the cells contains the text.
=ISNUMBER(MID(A2,SEQUENCE(,LEN(A2)),1))
We must, therefore, first convert each of the cells to a numerical value, if necessary. Thanks to the VALUE function, this conversion is automatic. The formula becomes.
=ISNUMBER(VALUE(MID(A2,SEQUENCE(,LEN(A2)),1)))



Step 3: Keep only the numbers
To extract only the list of numbers, we will use the FILTER function. FILTER returns the rows when the test is true.
=FILTER(VALUE(MID(A2,SEQUENCE(,LEN(A2)),1)),ISNUMBER(VALUE(MID(A2,SEQUENCE(,LEN(A2)),1))))



Step 4: Group the numbers together
Finally, the result of the FILTER expression will be embedded in a TEXTJOIN function
=TEXTJOIN("",,FILTER(MID(A8,SEQUENCE(LEN(A8)),1),NOT(ISNUMBER(VALUE(MID(A8,SEQUENCE(LEN(A8)),1))))))





29/03/2023 @ 06:54
Here is another formula that will retrieve the digits from a text string...
=CONCAT(IFERROR(0+MID(A2,SEQUENCE(LEN(A2)),1),""))