How to Extract the Final Number from a Text String in Excel
Question details
The user needs to extract a number of variable length that is located at the very end of a text string.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Extracting trailing numeric values (e.g., amounts) from descriptions or sentences where the number of digits varies, making fixed-length extraction impossible.
- Observed behavior
- The goal is to accurately isolate the trailing substring based on a delimiter or prefix, and convert it into a usable numeric value.
Identify the delimiter separating your text from the final number, such as a space or a specific preceding word (like 'VAT:'), as this determines which formula will work best.
Use the TEXTAFTER Function for Space-Delimited Strings
Best for modern spreadsheet software where the final number is separated from the preceding text by a space.
The TEXTAFTER function is highly efficient for isolating text after a specific delimiter. By using a negative instance number, it forces the formula to search from the end of the string backwards.
Click on the empty cell where you want the extracted number to appear (for example, cell B2).
Type =1*(TEXTAFTER(A2," ",-1)) into the formula bar and press Enter. The '1*' portion forces Excel to convert the extracted text string into a mathematical numeric value.
Click and drag the fill handle at the bottom-right corner of the cell downwards to apply the formula to the rest of the rows in your dataset.

Use RIGHT, LEN, and FIND for Specific Prefixes
Ideal for older versions of Excel or when the number follows a specific, consistent text prefix (e.g., 'Amount Ex VAT:').
Extract Text and Numbers Easily with WPS Spreadsheet
WPS Office provides a powerful, free Spreadsheet tool that fully supports standard Excel formulas, including RIGHT, LEN, FIND, and modern text functions. Easily handle complex data extraction tasks with high compatibility and a user-friendly interface.
- 1. Open your document in WPS Office: Launch WPS Office and open your spreadsheet file containing the text strings.
- 2. Apply the extraction formula: Select a blank cell and input your preferred extraction formula, such as =1*(TEXTAFTER(A2," ",-1)).
- 3. Format as Number: Right-click the result cell, select 'Format Cells', and choose 'Number' to ensure the extracted value is ready for further calculations.

Frequently Asked Questions
Why is the extracted number treated as text and cannot be summed?
Text extraction functions like RIGHT, LEFT, or TEXTAFTER always return text strings by default, even if they look like numbers. To convert them to usable numbers, wrap your formula in the VALUE() function, or multiply the entire formula by 1 (e.g., =1*RIGHT(...)).
How can I extract numbers from a string if there are no spaces or delimiters?
If the number lacks a clear delimiter and is directly attached to letters (e.g., 'Invoice12345'), you will need to use an array formula or a combination of functions like MIN, FIND, and ROW to locate the first numeric character's position, then extract from that point onward.
Does the TEXTAFTER function work in older versions of Excel?
No, TEXTAFTER is a modern dynamic array function only available in Microsoft 365 and Excel for the Web. For Excel 2019 or older standalone versions, you must use alternative text combinations like RIGHT, LEN, and FIND.




