Excel Formulas to Convert and Extract Numbers From Text

📅 Jul 13, 2026 📝 Sarah Miller

Manually separating numbers from cluttered text strings in Excel is a tedious, error-prone challenge for data professionals. When importing raw metrics from standard funding sources or legacy financial databases, numeric values often arrive trapped inside text headers.

Implementing a dynamic extraction formula grants you immediate analytical clarity and saves valuable processing time. Stipulation: This formula-based approach requires the numeric characters to reside in a predictable sequence within the cell. For instance, converting raw text like "ID-8500" into a pure numeric 8500.

In the following sections, we will break down the exact nested functions needed to master this transformation.

Excel Formulas to Convert and Extract Numbers From Text

Excel Formula To Convert Text With Numbers: The Ultimate Guide

Data imported into Excel from external systems-such as ERPs, CRMs, or web scraping tools-frequently arrives in a messy format. One of the most common issues data analysts face is dealing with numbers that are formatted as text, or numbers that are deeply embedded inside text strings (e.g., "USD 450", "Part#99823", or "15,000kg").

When Excel treats numbers as text, you cannot perform mathematical operations like SUM, AVERAGE, or use them in charts. In this comprehensive guide, we will explore several powerful Excel formulas and techniques to convert text with numbers into clean, usable numeric values.


1. The Difference Between "Text-Formatted Numbers" and "Mixed Text-Numbers"

Before writing a formula, you must identify which type of data problem you are trying to solve:

  • Numbers Stored as Text: The cell looks like a number (e.g., 123.45), but Excel treats it as text. This is often indicated by a small green triangle in the top-left corner of the cell.
  • Numbers Mixed with Text: The cell contains both letters and numbers (e.g., ID-8042 or $150.00 USD). Here, you must first extract the numeric characters before converting them.

2. Converting Numbers Stored as Text to Real Numbers

If your cells contain only numeric characters but are formatted as text, you can convert them instantly using simple formulas.

Method A: The VALUE Function

The VALUE function is Excel's built-in tool designed specifically to convert a text string that represents a number into an actual number.

Formula:

=VALUE(A2)

If cell A2 contains the text string "450.50", this formula returns the numeric value 450.50.

Method B: The Double Unary Operator (Double Minus)

The double unary operator (--) is a professional shortcut. It performs a mathematical negation twice. This forces Excel to convert the text to a number implicitly, without changing the mathematical value.

Formula:

=--A2

This method is preferred by power users because it processes faster than the VALUE function in large datasets.

Method C: Basic Math Operations

Any basic mathematical operation that doesn't change the value will force Excel to convert text to a number. You can multiply by 1 or add 0:

=A2 * 1
=A2 + 0

3. Extracting and Converting Numbers from the Beginning or End of Text

If your numbers are placed consistently at the start or end of your text strings, you can combine extraction functions (LEFT, RIGHT, MID) with VALUE.

Case 1: Numbers at the Beginning (e.g., "150ml", "45lbs")

If the numeric part is always on the left, but the length of the text suffix varies, you can use a formula that finds the first non-numeric character. However, if the text suffix has a fixed length (e.g., always 2 characters like "ml" or "kg"), use this straightforward approach:

=VALUE(LEFT(A2, LEN(A2) - 2))

How it works: The LEN function calculates the total character length of A2. Subtracting 2 strips away the trailing unit, and LEFT extracts the remaining numbers. Finally, VALUE converts the result.

Case 2: Numbers at the End (e.g., "Invoice_90482")

If the number is at the end of the text string and has a fixed length (e.g., 5 digits):

=VALUE(RIGHT(A2, 5))

If the prefix has a fixed length (e.g., "Invoice_" is always 8 characters):

=VALUE(MID(A2, 9, LEN(A2)))

4. Advanced: Extracting Numbers Mixed Anywhere in Text (Office 365 & 2021)

Extracting numbers becomes complex when they are randomly distributed or nested within text (e.g., "AB928X", "Room 101B", or "Cost: 1200 dollars"). If you are using Modern Excel (Office 365 or Excel 2021), dynamic arrays make this process remarkably simple.

The Modern Excel LET Formula

You can use the LET function to create a highly readable, step-by-step extraction formula. This formula analyzes every character in the cell, filters out everything except digits, and merges the digits back together.

=LET(
    text, A2,
    char_array, MID(text, SEQUENCE(LEN(text)), 1),
    numeric_chars, FILTER(char_array, ISNUMBER(--char_array)),
    CONCAT(numeric_chars) * 1
)

Step-by-Step Formula Breakdown:

  1. text, A2: Defines "text" as cell A2 to avoid repeating the cell reference.
  2. char_array, MID(text, SEQUENCE(LEN(text)), 1): Uses SEQUENCE and LEN to generate an array of numbers from 1 to the length of the string. MID then splits the text into an array of individual characters.
  3. numeric_chars, FILTER(...): Filters the array. The double unary (--char_array) turns digits into numbers and non-digits into #VALUE! errors. ISNUMBER identifies only the successfully converted digits.
  4. CONCAT(numeric_chars) * 1: Merges the filtered numeric characters back into a single string, then multiplies by 1 to convert the string to a true numeric value.

5. Extracting Numbers in Older Excel Versions (Excel 2019 and Prior)

If you are working on an older version of Excel, you cannot use SEQUENCE, FILTER, or LET. Instead, you must use a traditional array formula.

To extract numbers from mixed text, enter the following formula. If you are using Excel 2016 or older, you must press Ctrl + Shift + Enter instead of just Enter to make it an array formula:

=SUMPRODUCT(MID(0&A2, LARGE(INDEX(ISNUMBER(--MID(A2, ROW(INDIRECT("1:"&LEN(A2))), 1)) * ROW(INDIRECT("1:"&LEN(A2))), 0), ROW(INDIRECT("1:"&LEN(A2))))+1, 1) * 10^(ROW(INDIRECT("1:"&LEN(A2)))-1))

While effective, this formula is highly complex and difficult to troubleshoot. If your dataset is large, it can also slow down workbook calculation speeds. In such instances, using Excel's built-in Flash Fill tool is highly recommended.


6. How to Extract Decimal Numbers and Currencies

When dealing with prices (e.g., "$120.45 USD"), standard digit-extraction formulas may strip away the decimal point, transforming 120.45 into 12045. To retain decimals, we must allow the period character (.) to pass through our filters.

Office 365 Formula for Decimals

Modify the LET function to keep both digits and periods:

=LET(
    text, A2,
    char_array, MID(text, SEQUENCE(LEN(text)), 1),
    numeric_chars, FILTER(char_array, ISNUMBER(--char_array) + (char_array = ".")),
    VALUE(CONCAT(numeric_chars))
)

Note: This formula assumes there is only one decimal point in the text string. If multiple periods exist, it may return an error.


7. The Non-Formula Alternative: Flash Fill

If you only need to perform this task once and do not want to maintain active formulas, Excel's Flash Fill is the easiest and fastest solution.

  1. Insert a new empty column next to your data column.
  2. In the first row of the new column, manually type the exact number you want to extract from the adjacent cell.
  3. Press Enter to move to the next row.
  4. Begin typing the second number. Excel will likely detect the pattern and display a ghosted list previewing the extracted numbers.
  5. Press Enter to accept the suggestions. Alternatively, select the first cell and press Ctrl + E on your keyboard to instantly trigger Flash Fill.

Summary of Solutions

Scenario Best Formula / Method Example Result
Plain numbers stored as text =--A2 or =VALUE(A2) "123" becomes 123
Fixed text suffix (e.g., "150kg") =VALUE(LEFT(A2, LEN(A2)-2)) "150kg" becomes 150
Mixed text (Modern Excel) LET with FILTER and SEQUENCE "Room 404B" becomes 404
Mixed decimals (Modern Excel) LET with FILTER (allowing ".") "Price: $19.99" becomes 19.99
One-time cleanup (No formulas) Flash Fill (Keyboard Shortcut: Ctrl + E) Extracts patterns instantly

Conclusion

Converting text with numbers to pure numeric data is essential for data hygiene and analysis. For simple conversions, use the fast double unary (--) technique. For complex strings containing mixed letters and symbols, upgrade your workflow using modern dynamic array functions like LET and FILTER. Master these formulas, and you will save hours of manual data entry and cleaning!

Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.