Excel Formula to Extract Numbers from Text and Calculate Percentages
Question details
Extract integers embedded in a text string, calculate each as a percentage of a reference value, and combine the results into formatted text.

- Product
- Microsoft Excel 365
- Device & OS
- not provided
- Scenario
- A cell contains slash-separated values such as $10m/$20m, and another cell contains the reference value used to calculate percentages.
- Observed behavior
- The desired result is a formatted string such as $10m (10%)/$20m (20%) when the reference value is 100.
Check that the source values use a consistent delimiter and suffix, and that the reference cell contains a nonzero number in the same units as the extracted values. The examples below use B4 for text, B2 for the reference value, a slash as the delimiter, and lowercase m as the suffix.
Use a single Excel 365 formula to extract and format percentages
Use this formula when the source values consistently follow the $10m/$20m pattern and you want the result in one cell.
TEXTSPLIT separates the values, while SUBSTITUTE removes the dollar sign and m suffix. LET stores the intermediate results, and TEXTJOIN combines the formatted values.
Enter $10m/$20m in B4 and 100 in B2, or adjust the cell references in the formula to match your worksheet.
Select an empty cell and enter =LET(p,TEXTSPLIT(B4,"/"),n,--SUBSTITUTE(SUBSTITUTE(TRIM(p),"$",""),"m",""),TEXTJOIN("/",TRUE,"$"&TEXT(n,"0")&"m ("&TEXT(n/$B$2,"0%")&")"))
Press Enter. With the example values, the cell displays $10m (10%)/$20m (20%). Change 0% to 0.0% in the formula if you need one decimal place.

Split the text into columns and calculate percentages separately
Use helper columns when you want to inspect each extracted number and calculation.
Extract and calculate text values in WPS Spreadsheet
Use helper formulas in WPS Spreadsheet to extract two slash-separated values, divide them by a reference, and rebuild the formatted result.
- 1. Enter the example data: Open the workbook in WPS Spreadsheet. Enter $10m/$20m in B4 and 100 in B2, or adjust the formulas to use your cells.
- 2. Extract the first value: In C4, enter =VALUE(SUBSTITUTE(SUBSTITUTE(TRIM(LEFT(B4,FIND("/",B4)-1)),"$",""),"m",""))
- 3. Extract the second value: In D4, enter =VALUE(SUBSTITUTE(SUBSTITUTE(TRIM(MID(B4,FIND("/",B4)+1,LEN(B4))),"$",""),"m",""))
- 4. Build the formatted result: In E4, enter ="$"&TEXT(C4,"0")&"m ("&TEXT(C4/$B$2,"0%")&")/$"&TEXT(D4,"0")&"m ("&TEXT(D4/$B$2,"0%")&")". For the example, the result is $10m (10%)/$20m (20%).

Frequently Asked Questions
Why does the formula return a divide-by-zero error?
The reference cell B2 is zero or empty. Enter a nonzero reference value in B2, using the same units as the numbers extracted from the text.
Can I show percentages with decimal places?
Yes. Change the TEXT format from "0%" to "0.0%" for one decimal place or "0.00%" for two.
What if my values use a different delimiter?
In the Excel 365 formula, replace "/" in TEXTSPLIT with the delimiter used in the source text. Change the delimiter in TEXTJOIN too if you want the output to use the same separator.
Why does TEXTSPLIT return a spill error?
The cells where the split results would appear are not empty. Clear those cells or enter the formula in an area with enough empty columns.




