Remove values from a string of numbers

ChristineJ

Well-known Member
Joined
May 18, 2009
Messages
781
Office Version
  1. 365
Platform
  1. Windows
Is there a formula for A3 to return a string of all numerical amounts in the formula in A1 EXCEPT those used to designate the number of decimals in ROUND functions?

FORMULA in cell A1 =ROUND(E15,0)+ROUND(E16,3)+SUM(E17,6)+0+ROUND(SUM(E21,10)+B29,0)+ROUND(E24-20,2)+3

All numbers in formula in A1, in sequence 0, 3, 6, 0, 10, 0, 20, 2, 3

RESULT in cell A3 should be 6, 0, 10, 20, 3
(only numbers not used to designate number of decimals in ROUND functions, separated by a comma and space)
 
Difficult to think of every possible scenario for numbers to be in a formula, but see how this goes.

ChristineJ.xlsm
A
1121.34
2
3
4
56, 2.34, 10, 20, 3, 2, 5, 7
Extract Nums (2)
Cell Formulas
RangeFormula
A1A1=ROUND(E15,0)+ROUND(E16,13)+SUM($E17,6)+2.34+ROUND(SUM(E21,10)+B29,-1)+ROUND(E$24-20,-2)+3+SUM(2,5,3:3,-7)
A5A5=TEXTJOIN(", ",,REGEXEXTRACT(REGEXREPLACE(REGEXREPLACE(SUBSTITUTE(FORMULATEXT(A1),"$",""),"ROUND\(([A-Z]+\([^()]+\)[^()]+|[^()]+[^()]+),\-?\d+\)","\1"),"([A-Z]\d+)|(\d+:\d+)","X"),"(\d+\.*\d*)",1))
 
Upvote 0
Solution
Excellent! I tried all sorts of changes and it worked every time. Thanks again. C
 
Upvote 0
I tried all sorts of changes and it worked every time.
Here is one that doesn't.

ChristineJ.xlsm
A
119
2
3
4
54.3, 2, 3, 0
Extract Nums (2)
Cell Formulas
RangeFormula
A1A1=ROUND((4.3+2)*3,0)
A5A5=TEXTJOIN(", ",,REGEXEXTRACT(REGEXREPLACE(REGEXREPLACE(SUBSTITUTE(FORMULATEXT(A1),"$",""),"ROUND\(([A-Z]+\([^()]+\)[^()]+|[^()]+[^()]+),\-?\d+\)","\1"),"([A-Z]\d+)|(\d+:\d+)","X"),"(\d+\.*\d*)",1))


I have tried adjusting the formula further but every time I solve one circumstance another seems to go wrong. :(
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top