How to Download Your Amazon Products as CSV - FlatFilePro
Excel

How to Download Your Amazon Products as CSV - FlatFilePro

2048 × 1152 px January 9, 2026 Ashley Excel
Download

Data cleaning is often the most time-consuming part of any analytical project, and one of the most frequent challenges users face is dealing with "dirty" data where numeric values are trapped inside text strings. Whether you are dealing with product codes, inconsistent addresses, or imported financial reports, knowing how to extract number from string in Excel is a vital skill that can save you hours of manual entry. This guide provides a deep dive into every method available, ranging from simple built-in features to complex formulas and modern dynamic arrays.

Understanding the Challenge of Mixed Data

Excel Data Analysis Concept

Excel treats data as either text or numbers. When a number is combined with letters—such as "Part #12345" or "45.50 USD"—Excel treats the entire cell as text. This prevents you from performing calculations like sums, averages, or pivot table analysis. The goal of learning how to extract number from string in Excel is to isolate these digits so they can be converted back into a functional numeric format.

The complexity of the solution usually depends on the pattern of your data:

  • Consistent Patterns: Numbers are always at the start, end, or a specific position.
  • Inconsistent Patterns: Numbers are scattered randomly throughout the text.
  • Delimited Data: Numbers are separated by a specific character like a dash or space.

Method 1: Using Flash Fill for Instant Results

Introduced in Excel 2013, Flash Fill is the easiest way to extract data without writing a single formula. It works by recognizing patterns based on your manual input.

  1. In the column next to your mixed data, type the number exactly as it appears in the first cell.
  2. In the second cell, start typing the number from the second row.
  3. Excel will likely show a ghosted list of suggestions. Press Enter to accept them.
  4. If it doesn't trigger automatically, go to the Data tab and click Flash Fill or press Ctrl + E.

💡 Note: Flash Fill is static. If you change the original text, the extracted number will not update automatically.

Method 2: Extracting Numbers from Fixed Positions

When your data follows a strict format, you can use basic text functions. These are the "bread and butter" of Excel data manipulation.

Using LEFT and RIGHT Functions

If the numbers are always at the beginning or the end of the string, use these:

  • LEFT(text, num_chars): Extracts characters from the start.
  • RIGHT(text, num_chars): Extracts characters from the end.

For example, if cell A2 contains "ID-8842", the formula =RIGHT(A2, 4) will return "8842".

Using the MID Function

If the number is in the middle, use =MID(text, start_num, num_chars). This requires you to know exactly where the number starts and how long it is.

Method 3: Advanced Formulas for Dynamic Extraction

Advanced Spreadsheet Formulas

Often, the length of the text and the number varies. In these cases, you need a dynamic formula to determine how to extract number from string in Excel regardless of where the digits are located.

Extracting Numbers from the Left (Variable Length)

If you have data like “123Apple” and “45678Orange”, use this formula:

=LEFT(A2, SUMPRODUCT(LEN(A2) - LEN(SUBSTITUTE(A2, {“0”,“1”,“2”,“3”,“4”,“5”,“6”,“7”,“8”,“9”}, “”))))

Extracting Numbers from the Right (Variable Length)

For data like “Invoice_994” or “Serial_10023”, use:

=RIGHT(A2, SUMPRODUCT(LEN(A2) - LEN(SUBSTITUTE(A2, {“0”,“1”,“2”,“3”,“4”,“5”,“6”,“7”,“8”,“9”}, “”))))

⚠️ Note: These formulas work best when the number is strictly on one side. If there are digits elsewhere in the string, the count might become inaccurate.

Method 4: The Powerful "TEXTJOIN" Method (Excel 2019/365)

If you are using a modern version of Excel, the TEXTJOIN and SEQUENCE functions provide a revolutionary way to solve the problem of how to extract number from string in Excel when numbers are scattered everywhere (e.g., "abc123def45").

Use the following formula:

=TEXTJOIN("", TRUE, IFERROR(MID(A2, SEQUENCE(LEN(A2)), 1) * 1, ""))

How this formula works:

  • SEQUENCE(LEN(A2)): Creates a list of numbers from 1 to the length of the text.
  • MID(A2, ..., 1): Breaks the string into individual characters.
  • * 1: Attempts to multiply each character by 1. Numbers stay numbers, but letters result in a #VALUE! error.
  • IFERROR(..., ""): Replaces errors (letters) with empty strings.
  • TEXTJOIN: Combines the remaining numbers back together.

Method 5: Extraction via Power Query

For large datasets, Power Query is the most robust tool. It provides a user interface to transform data without writing complex formulas.

  1. Select your data and go to Data > From Table/Range.
  2. In the Power Query editor, go to the Add Column tab and select Custom Column.
  3. Use the following M code: Text.Select([ColumnName], {"0".."9"}).
  4. Click OK, then click File > Close & Load to return the numbers to Excel.

Power Query is highly recommended because it handles millions of rows efficiently and can be refreshed whenever the source data changes.

Comparison of Extraction Methods

Method Difficulty Dynamic? Best For
Flash Fill Very Low No One-time tasks, simple patterns
LEFT/RIGHT Formulas Low Yes Fixed format data
TEXTJOIN Array High Yes Scattered numbers in Excel 365
Power Query Medium Yes Large datasets and automation
VBA Macro Very High Yes Complex, repetitive custom logic

Method 6: Using User-Defined Functions (VBA)

If you frequently need to know how to extract number from string in Excel across different workbooks, creating a custom VBA function is a great solution.

Follow these steps to create a function called ExtractNums:

  1. Press Alt + F11 to open the VBA Editor.
  2. Go to Insert > Module.
  3. Paste the following code:
Function ExtractNums(Str As String) As String
    Dim i As Integer
    For i = 1 To Len(Str)
        If IsNumeric(Mid(Str, i, 1)) Then
            ExtractNums = ExtractNums & Mid(Str, i, 1)
        End If
    Next i
End Function

Now, you can use =ExtractNums(A2) in your spreadsheet just like a regular Excel function.

Handling Decimals and Negative Numbers

Financial Spreadsheet Data

Most simple extraction methods only pull whole digits. If you need to extract " -45.50 " from "Temperature: -45.50C", the logic becomes significantly more complex. Standard digit-filtering will remove the minus sign and the decimal point, leaving you with "4550".

To keep decimals, you must include the period (.) in your allowed character list. In Power Query, the code would change to: Text.Select([ColumnName], {"0".."9", "."}).

🚀 Note: Be careful when using decimal extraction if your text contains periods for other reasons (like at the end of a sentence), as this will include those periods in your extracted value.

Common Pitfalls and Troubleshooting

When learning how to extract number from string in Excel, you might encounter these common issues:

  • Numbers Stored as Text: Even after extraction, Excel might still think the number is text. To fix this, multiply the result by 1 (e.g., =VALUE(ExtractFormula)).
  • Leading Zeros: If you extract "007" from "Bond007", Excel might convert it to "7". Use a custom number format "000" if you need to keep the zeros.
  • Dates: Remember that Excel stores dates as serial numbers. Extracting numbers from a date string might return a value like 45123 instead of the date you expect.
  • Non-Breaking Spaces: Data imported from the web often contains hidden characters (Char 160). Use the CLEAN and TRIM functions before attempting extraction.

Frequently Asked Questions

Can I extract only the first number found in a string?

Yes, this usually requires a combination of MIN and FIND functions to locate the position of the first digit, then using MID to pull a sequence starting from that position.

Is there a way to extract numbers without using formulas?

Yes, Flash Fill and Power Query are the primary non-formula methods. Power Query is especially powerful for users who prefer a graphical interface over typing code.

What if I have multiple separate numbers in one cell?

If you want to extract “10” and “20” from “10 apples and 20 oranges” into separate columns, the Text to Columns feature combined with a delimiter (like a space) is usually the most efficient first step.

Final Thoughts on Data Extraction

Mastering how to extract number from string in Excel is a transformative skill for any data professional. By moving beyond manual typing, you reduce the risk of human error and ensure your reports are easy to update. For quick, one-off tasks, Flash Fill is your best friend. For recurring reports with messy data, investing time in Power Query will pay dividends. If you are working within the latest version of Excel 365, the dynamic array formulas like TEXTJOIN and SEQUENCE offer the most elegant and flexible solutions available today. Choose the method that fits your specific data structure, and you will find that even the messiest spreadsheets become manageable.

Related Terms:

  • extracting numbers from excel cell
  • excel extract integer from string
  • pull number from text excel
  • excel return number from text
  • pull number from string excel
  • excel pick number from string

More Images