Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Thanks Dave
That will work fine. "Dave Peterson" wrote in message ... You're gonna need some VBA to evaluate the expression. Option Explicit Function Eval(myStr As String) As Variant Eval = Application.Evaluate(myStr) End Function Then you'd use: =eval(SUBSTITUTE(SUBSTITUTE(TRIM(D4),"/","*")," ","+")) in your cell. You could do the substitutes in code, too. But then you couldn't use your =eval() without those substitutions. Option Explicit Function Eval(myStr As String) As Variant With Application Eval = .Evaluate(.Substitute _ (.Substitute(.Trim(myStr), "/", "*"), " ", "+")) End With End Function Then you'd use: =eval(d4) In either case... If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Short course: Open your workbook. Hit alt-f11 to get to the VBE (where macros/UDF's live) hit ctrl-R to view the project explorer Find your workbook. should look like: VBAProject (yourfilename.xls) right click on the project name Insert, then Module You should see the code window pop up on the right hand side Paste the code in there. Now go back to excel. Into a test cell and type: =eval(a1) Neil wrote: I have a list of quantites in one cell "D4" "D4" = 6/6 3/2.6 5/1.2. I need to sum each of these to a total so I use the following formula =SUBSTITUTE(SUBSTITUTE(TRIM(D4),"/","*")," ","+") Result: "6*6+3*2.6+5*1.2" How can I convert the result to a formula that would show the sum 49.8 Thanks for any help. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can a Formula in Cell X modify Cell Y? | Excel Discussion (Misc queries) | |||
looking for a formula | Excel Worksheet Functions | |||
How do I add a date formula to a cell but hide the contents with . | Excel Discussion (Misc queries) | |||
How can I write an if-then formula for 0 or less than 0 in cell t. | Excel Worksheet Functions | |||
How do I do math on a cell name in formula? | Excel Worksheet Functions |