How to Separate Numbers from Text in Excel

If you just need to separate numbers from text in excel and move on, the boxed answer at the top is all you need. The rest of this page is for when you want to understand why it works in Excel, adapt it to a trickier version, or make it robust enough to hand to a colleague. We keep the opening short on purpose — the depth is here when you want it, not in your way when you don’t.

Exact answer

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. Function availability: TEXTJOIN: Excel 2019+; SEQUENCE: Excel 2021+. These are Microsoft's version markers; earlier perpetual releases do not include these functions. Check the actual product and update channel before using the formula. A marker does not establish an identical Web/Mac workflow or Google Sheets support.

On this page7
▤Annotated stepsExcel
1

Function availability: TEXTJOIN: Excel 2019+; SEQUENCE: Excel 2021+. These are Microsoft's version markers; earlier perpetual releases do not include these functions. Check the actual product and update channel before using the formula. A marker does not establish an identical Web/Mac workflow or Google Sheets support.

2

Confirm the pattern first: one number per cell, or several?

3

For one number per cell in Microsoft 365, enter the TEXTJOIN formula and fill it down.

4

Wrap the result in VALUE when the output feeds arithmetic, or leave it as text when it is a reference code with leading zeros.

5

For a fixed layout, try Flash Fill instead: type the first result by hand, press Ctrl+E and check every row it produced.

6

When the number always follows the same word, TEXTAFTER(A2," ") or a MID with FIND is simpler and safer than the character walk.

=TEXTJOIN("",TRUE,IFERROR(MID(A2,SEQUENCE(LEN(A2)),1)*1,""))
Ctrl+CthenCtrl+Shift+V⌘+Cthen⌘+Ctrl+VPaste values · WindowsMac

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. For “separate numbers from text in excel”, the reliable version is a short checking loop, not just the first command that appears to work. Run it on a deliberately small range first, watch how the affected cells change, and only then apply the same setup to the full sheet. 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. That is what makes a calculation you can defend to a CFO or an auditor useful in real work: repeatable, auditable, and not dependent on memory or luck.

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. Check the referenced cells, argument order and result type in your workbook. Start with the worked example before changing an input, then compare the changed result with the calculation you expected. An error value or a result of a different type is a reason to inspect the inputs and arguments.

In Google Sheets

Google Sheets support for this task has not been verified. Check the function, arguments and workflow in the target product before transferring the example. Matching formula notation does not establish identical behaviour. Keep this page bookmarked for the next time the same question comes up. Better still, repeat the steps once in your own workbook — doing it yourself is what turns a copied answer into something you remember. For “separate numbers from text in excel”, keep the input cells and the result visible while you check the formula in Excel. Follow the worked example and change one input at a time. The steps explain the workbook calculation; this page does not run a live calculator for that task.

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.

Which Excel release does this formula require?

Function availability: TEXTJOIN: Excel 2019+; SEQUENCE: Excel 2021+. These are Microsoft's version markers; earlier perpetual releases do not include these functions. Check the actual product and update channel before using the formula. A marker does not establish an identical Web/Mac workflow or Google Sheets support.

Other ways people ask this

People reach this page typing “how do i separate numbers from text in excel”, “how to separate text from numbers in excel”, “how to separate numbers from words in excel” and “separate numbers from text in excel”, among other phrasings; whichever wording you used, the fix above is the one you want.

Why do people search for this in so many different ways?

Because the same task has many names. “how do i separate numbers from text in excel”, “how to separate text from numbers in excel”, “how to separate numbers from words in excel” all point at the one operation explained on this page, which is why they all lead here.