In Excel: in Microsoft 365, =TEXTJOIN("",TRUE,IFERROR(MID(A2,SEQUENCE(LEN(A2)),1)*1,"")) walks the string one character at a time and keeps only the digits.
On this page7
3 rows
| Ada Lovelace | London | 1815 |
| Grace Hopper | New York | 1906 |
| Alan Turing | London | 1912 |
What this does
The formula tests each character in turn: MID with SEQUENCE splits the cell into single characters, multiplying by 1 turns a digit into a number and raises an error for anything else, IFERROR discards the errors, and TEXTJOIN glues the survivors back together. The result is text, so wrap it in VALUE when it has to be used as a number, and remember every digit in the cell is kept — a string with two separate numbers comes back as one run of digits. Keep the inputs visible and clearly labelled and the whole thing stays auditable — anyone who opens the file later, including you, can see at a glance exactly what feeds the result and change one assumption without hunting through the formula. The difference between a quick fix and a sheet you can trust is the extra minute you spend validating “extract numbers from a cell in excel”. Start on a copy or a tiny sample, keep the affected cells visible, and compare the result with the tool above before you touch the real workbook. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. The point is a layout choice that keeps the sheet readable and sortable, but the practical win is that someone else can open the file and understand what happened without asking you.
A worked example
A2 holds "Invoice 2291 approved". The formula returns 2291 as text; =VALUE(TEXTJOIN("",TRUE,IFERROR(MID(A2,SEQUENCE(LEN(A2)),1)*1,""))) returns the number 2291. For "Order 12 of 34", the same formula returns 1234, which is the behaviour to design around rather than be surprised by. Reference numbers arrive glued to descriptions from every export in the world, and the difference between a number and text that looks like one decides whether the join downstream works at all. If there is any chance you will reuse this, drop it into a small template tab right now: a labelled input area on the left and the formula beside it, checked once against the tool above. Next time the same question comes up, the answer is a single paste away instead of a rebuild from memory.
In Google Sheets
Everything above works in Google Sheets too. Excel and Sheets share the formula syntax used here; only the surrounding menus are arranged differently. That portability is deliberate — learn it once and it follows you between the two tools and across Windows and Mac. Keep this page bookmarked for the next time the same question comes up. Better still, rebuild the example once in your own sheet — doing it yourself, with the tool above to check against, is what turns a copied formula into a technique you own. Here is the takeaway for “extract numbers from a cell in excel”: copy the answer if you are busy, but if you have a spare few minutes, rebuild the example in Excel yourself with the tool above open beside it. That single pass — type it, run it, watch the result move when you change an input — is what turns a formula you found into a technique you trust. Keep your inputs labelled and referenced, never hard-coded, and the same sheet stays correct and auditable as it grows. Done that way, you will not need to look this up again, and you will be the person others ask.
Common mistakes
- Applying the digit-walk to strings that contain several numbers and getting them silently concatenated.
- Losing the decimal point and the minus sign: both are non-digits, so 12.50 comes back as 1250.
- Converting a reference code such as 00427 to a number and dropping its leading zeros.
- Trusting Flash Fill without checking the whole column — it infers a pattern from the first rows and applies it everywhere.
Frequently asked questions
What if I do not have Microsoft 365?
Replace SEQUENCE(LEN(A2)) with ROW(INDIRECT("1:"&LEN(A2))) and confirm the formula with Ctrl+Shift+Enter, or use Flash Fill.
How do I keep the decimal point?
Test for digits and the separator together, or locate the number with FIND and take a fixed-width MID rather than filtering character by character.
How do I extract the text and drop the numbers instead?
Invert the test: keep the characters where the multiplication fails, which is the same formula with IF(ISERROR(...)) around the character.
Does the result sort correctly?
Only after VALUE converts it. Text digits sort 1, 10, 2 rather than 1, 2, 10.
Other ways people ask this
On the way here you may have searched this as “excel extract number from cell”, “extract numbers from excel cell”, “how to extract a number from a cell in excel” and “how to extract number from cell in excel” — it is all the same task, and this page is the single, complete answer to it.
Why do people search for this in so many different ways?
Because the same task has many names. “excel extract number from cell”, “extract numbers from excel cell”, “how to extract a number from a cell in excel” all point at the one operation explained on this page, which is why they all lead here.