How to Extract Numbers from Text (Decimals, Signs and Thousands Separators)
A block of text holds prices, IDs, dates and phone numbers at once. When only the digits matter, pasting the text beats selecting each one: runs of digits are returned with their sign and decimal part.
When you need the numbers on their own
A quote email says 128.50 per unit, 385.50 for three, minus 12.50 discount. Checking the arithmetic starts with separating the digits from the prose. The same goes for pulling durations out of logs or IDs out of a report: split the numbers from the labels first, then check them line by line.
The other use is verifying a copy. Paste a column of numbers as text and compare it against the original table; reading two columns side by side by eye is how a missing digit slips through.
- Pulling amounts out of quotes or invoices
- Collecting durations, IDs and counts from logs
- Checking a copied column against the source table
- Turning mixed text into a list of usable numbers
What counts as part of a number
The rule is an optional minus sign, a run of digits, and an optional decimal point with more digits. So -12.50 survives intact and 3.14 stays whole. A thousands separator does not count: 1,000 splits into 1 and 000. A date such as 2024-05-01 becomes 2024, -05 and -01, because the hyphen reads as a minus sign.
Phone numbers split the same way, so 138-0000-0000 yields 138, -0000 and -0000. Full-width digits and Chinese numerals are outside the rule. Check the output line by line afterwards to make sure no date or phone fragment has been counted as an amount.
- Minus signs and decimals are kept: -12.50 stays whole
- Thousands separators split: 1,000 becomes 1 and 000
- Dates and phone numbers break at hyphens
- Full-width and CJK numerals are not matched
- One result per line, in order of appearance
Using the numbers without getting them wrong
Extraction picks characters; it does not understand units. 50% yields 50, and 1,200 yen yields 1 and 200, with the currency and percent sign left behind in the source. Before pasting into a calculator or spreadsheet, restore the unit and the magnitude, or a thousand becomes a single unit.
It also does not sum, sort or deduplicate, and the order is simply the order of appearance. Send the result to a spreadsheet for arithmetic. Scientific notation breaks apart as well, with 1e5 producing 1 and 5, so correct those by hand when they appear.
- Units, currency symbols and percent signs are lost
- No summing, sorting or deduplication
- Scientific notation is split and needs fixing
- Restore magnitude before pasting into a sheet
FAQ
Are decimals and negative numbers kept whole?
Yes. The rule allows one optional minus sign and one decimal part, so -12.50 and 3.14 come out intact. Repeated decimal points, the e in scientific notation and thousands separators are outside the rule, so fix those by hand in the result.
Why did 1,000 turn into two numbers?
Because a comma is not treated as part of a number, the match stops there and produces 1 and 000. For amounts, delete the thousands separators before extracting, or join the adjacent pieces back together afterwards.
Can full-width digits be extracted?
No. Matching covers half-width 0 to 9 only, so full-width digits and Chinese numerals are skipped entirely. Convert full-width characters to half-width first if the text uses them, then extract for a complete result.
Related tool:Extract Numbers