[英]How can I calculate the text in one cell as a formula in another cell in microsoft excel?
Here is what I want the Spreadsheet to look like. 这就是我希望电子表格的外观。
COLUMN A COLUMN B COLUMN C COLUMN D
ROW1 hello 1 hello+hi 10
ROW2 hi 9 hello*hi 9
I want to be able to name the cell B1 after the text in cell A1 and the cell B2 after the text in the cell A2. 我希望能够以单元格A1中的文本命名单元格B1,并以单元格A2中的文本命名单元格B2。 Then I want to be able to compute the equations in column C and put the answers in column D.
然后,我希望能够在C列中计算方程式并将答案放在D列中。
Any help with this would be greatly appreciated. 任何帮助,将不胜感激。
EVALUATE is available in VBA in all current versions EVALUATE在所有当前版本的VBA中均可用
You can include it in you VBA code, or wrap it into a simple UDF to make it available as a worksheet function 您可以将其包含在VBA代码中,或将其包装到简单的UDF中以使其可用作工作表功能
Function ev(r As Range) As Variant
ev = Evaluate(r.Value)
End Function
It basically treats the value of the passed parameter as an excel formula, same as if it were entered in a cell 它基本上将传递的参数的值视为excel公式,就像在单元格中输入的一样
"11+5"
and "=11+5"
will produce the same result "11+5"
和"=11+5"
将产生相同的结果
reference: https://superuser.com/questions/253353/excel-function-that-evaluates-a-string-as-if-it-were-a-formula 参考: https : //superuser.com/questions/253353/excel-function-that-evaluates-a-string-as-if-it-were-a-formula
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.