Spreadsheet data

How to extract a number from text in Excel

2026-06-28
Task

A supplier file stores stock as text: In stock: 12 pcs, Only 3 left, Preorder 25 pcs. The import needs a separate qty column that keeps only the number: 12, 3, 25.

Short answer

Create qty from stock_text and add one transformation: condition Regular expression with \d+, action Remove everything except.

How to do it in Eofferix

  1. Upload the CSV or XLSX file with the stock_text column and open the table editor. The sample keeps a product column next to it for row checking.

  2. Create the result column qty from the source column stock_text.

  3. Open the settings for the qty column with the gear icon in its header.

    Opening qty column settings in the Eofferix table editor
    The animation opens the result column qty, where the extracted number will be stored.
  4. In Transformations, choose Regular expression, enter \d+, and set the action to Remove everything except.

    Eofferix rule: regular expression \d+ and Remove everything except
    The regex \d+ finds the first number in the text, and the action keeps only that matched fragment.
  5. Save the settings and check the preview: In stock: 12 pcs should become 12, and Only 3 left should become 3.

Before / after

Before

source data
stock_textproduct
In stock: 12 pcsHudson desk lamp
Only 3 leftMaple wall shelf
Preorder 25 pcsTrail travel mug

After

result
qtyproduct
12Hudson desk lamp
3Maple wall shelf
25Trail travel mug

What to keep in mind

  • Use this setup when the first number in the text is the value you need.
  • If one cell contains several numbers and you need a later one, make the regular expression more specific.
  • After extraction, the number can be used in filters, formulas, and export conditions.

Process data faster with Eofferix

Create a free account to automate catalogs and price lists around your own rules.

Sign up