Easy Excel Formula to Extract Number from Text
Working with data often means dealing with messy information. A common problem is when numbers are stuck inside text cells. You might have entries like “Order123”, “Price: $45.99”, or “Room 205B”.
Manually picking out the numbers takes far too much time. In this guide, we will explain the best Excel formulas to extract numbers from text, helping you clean your data quickly.
Understanding Your Text Data Structure
Before choosing a formula, look at your text string. The structure of your data determines the best method. Ask yourself these questions:
- Are the numbers always at the beginning, end, or middle of the text?
- Is there a consistent separator, like a dash or space?
- Do numbers include decimals or commas (like 1,200.50)?
- Are there multiple numbers in a single cell?
Identifying these patterns is the first step to an effective solution.
Core Excel Functions for Text Manipulation
To pull numbers from text, we combine several powerful Excel text functions.
| Function | What It Does | Simple Example |
|---|---|---|
| LEFT, RIGHT, MID | Extracts text from the start, end, or middle of a cell. | =LEFT("A1B2",2) returns “A1”. |
| LEN | Counts the total characters in a text string. | =LEN("Excel") returns 5. |
| FIND & SEARCH | Locates the position of a specific character. SEARCH is not case-sensitive. | =SEARCH(" ", "Room 205") returns 5. |
| ISNUMBER | Checks if a value is a number. Returns TRUE or FALSE. | =ISNUMBER(5) returns TRUE. |
| VALUE | Converts a text string that looks like a number into a real number. | =VALUE("123") returns 123 as a number. |
Effective Formula Methods to Extract Numbers
Method 1: Extract Numbers from a Specific Position
If the numbers are always in the same place, simple functions work best.
Example: Numbers at the End of Text
For data like “Item456”, you can combine RIGHT, LEN, and VALUE.
=VALUE(RIGHT(A1, LEN(A1) - 3))This formula assumes the first 3 characters are text. It counts total characters, subtracts 3, and takes that many characters from the right, then converts to a number.
Example: Numbers After a Specific Character
For “Price: 100”, where the number follows a colon and space, use MID and FIND.
=VALUE(MID(A1, FIND(":", A1) + 2, 20))This finds the colon, starts 2 characters after it (to skip the space), and extracts up to 20 characters.
Method 2: The Advanced Array Formula for Mixed Text
When numbers are embedded randomly inside text like “ABC123XYZ45”, you need a more powerful approach. This method uses an array formula with the TEXTJOIN, IF, ISERR, and MID functions.
=VALUE(TEXTJOIN("", TRUE, IF(ISERR(--MID(A1, ROW($1:$100), 1)), "", MID(A1, ROW($1:$100), 1))))Important: Press Ctrl + Shift + Enter to enter this as an array formula. In newer versions of Excel with dynamic arrays, pressing Enter may work.
How this complex formula works:
ROW($1:$100)looks at the first 100 characters of the cell one by one.MID(...)pulls each individual character.ISERR(--MID(...))tests if forcing that character to be a number causes an error. If it does, it’s not a digit (0-9).- The
IFfunction keeps the digit if it’s a number, or replaces it with an empty string (“”) if it’s not. TEXTJOINcombines all the kept digits together into one string with no separator.VALUEconverts that final string of digits into a usable numeric value.
Method 3: Using the Flash Fill Feature
For one-time tasks, Excel Flash Fill is a fantastic, formula-free tool.
- Type the number you want to extract in the cell next to your first data example.
- Start typing the extracted number for the second example in the cell below.
- Excel will show a preview. Press Enter to accept, and Flash Fill will populate the rest of the column.
This method uses pattern recognition and is great for quick, manual cleanup jobs.
Handling Decimal Points and Negative Numbers
The previous array formula joins all digits. To keep decimal points or negative signs, you need to modify the logic test.
Instead of just checking for digits 0-9, you must also allow the period (.) and minus sign (-).
A more robust formula for extracting numeric values looks like this:
=VALUE(TEXTJOIN("", TRUE, IF(ISNUMBER(--MID(A1&" ", ROW($1:$100), 1)), MID(A1, ROW($1:$100), 1), IF(MID(A1, ROW($1:$100), 1)=".", ".", IF(COUNTIF({"-","+"}, MID(A1, ROW($1:$100), 1)), MID(A1, ROW($1:$100), 1), "")))))This allows digits, a single decimal point, and leading plus or minus signs.
Best Practices for Clean Data Extraction
- Always Check Results: After extracting, use the
ISNUMBERfunction in a new column to verify your results are true numbers. - Preserve Original Data: Never work directly on your raw data. Keep an original column and perform extractions in a new column.
- Use Helper Columns: Breaking a complex formula into steps across multiple columns can make it easier to debug.
- Understand Your Data Source: Knowing if your numbers include currency symbols, commas, or multiple decimal points is key to choosing the right formula.
Frequently Asked Questions
What is the simplest formula to get a number from the end of text?
If your number is always at the end, like in “Order123”, you can use a combination of RIGHT, LEN, and VALUE. For example, =VALUE(RIGHT(A1, LEN(A1) - 3)) will extract the number if the first 3 characters are text. Adjust the number “3” based on how many text characters you have at the start.
How do I extract a number that has a decimal point?
The basic array formula that joins only digits (0-9) will remove decimal points. You need a more advanced formula that also checks for the period character. The formula provided in the “Handling Decimal Points” section includes logic to preserve the decimal point so results like “45.99” are extracted correctly as a number.
Why does my extracted number show as text and not calculate?
This usually happens when the result is a numeric string, not a true number. Wrap your extraction formula in the VALUE function to convert it. For example, use =VALUE(YOUR_FORMULA_HERE). You can also check the format by using =ISNUMBER(YOUR_CELL) which will return FALSE if the value is text.
Can I extract numbers without using a complex array formula?
Yes, you have two main options. First, try Excel Flash Fill (Data tab) which can recognize your manual pattern. Second, for repetitive tasks, use Power Query (Get & Transform Data). Power Query has a graphical interface to split columns by digit and non-digit, which is easier for many users than writing formulas.
What if my text has multiple numbers I need to keep separate?
The formulas shown will merge all digits into one number (e.g., “Room 205B” becomes 205, but “Room 20 Chair 5” becomes 205). To keep numbers separate, you likely need a different approach. Consider using Text to Columns with a space or letter delimiter, or using Power Query for more advanced separation logic.
My formula shows a #VALUE! error. How do I fix it?
A #VALUE! error often means the formula couldn’t find any numbers to extract, resulting in an empty string that VALUE can’t convert. To fix this, you can wrap the formula in IFERROR. For example: =IFERROR(VALUE(TEXTJOIN(...)), ""). This will return a blank cell if no number is found, instead of an error.

Vaishvi Desai is the founder of Excelsamurai and a passionate Excel enthusiast with years of experience in data analysis and spreadsheet management. With a mission to help others harness the power of Excel, Vaishvi shares her expertise through concise, easy-to-follow tutorials on shortcuts, formulas, Pivot Tables, and VBA.
