简体   繁体   English

如何在Microsoft Excel中将一个单元格中的文本作为另一个单元格中的公式计算?

[英]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.

相关问题 Excel公式搜索一个单元格并替换另一单元格中的文本 - Excel Formula to Search One Cell and Replace Text in Another Cell 如何在Microsoft Excel中使用公式添加左单元格和上单元格? - how can I add the left cell and the upper cell using a formula in microsoft excel? 如何将单元格的文本添加到Excel公式中? - How can I add a cell's text into an excel formula? 在Excel中如何将文本从一个单元格替换为另一个单元格 - In Excel how can I replace the text from one cell into another cell 我是否可以将一个单元格值作为公式相等地传递给另一单元格? - Can I Pass one cell value as formula into another cell by equal? 如何根据另一个单元格的值更改单元格的公式 - How can I change the formula of the cell according to the value of another cell 是否存在一个可以将一个单元格中的一个字符串到另一个单元格中的所有蓝色字体数字求和的excel公式? - Is there an excel formula that I can use to sum all blue font numbers from a string in one cell to another? 在Excel中,我可以使用什么公式在一个单元格中重复文本,并在连续的行中重复指定的时间? - In Excel, what formula can I use to repeat text in one cell, for a specified amount of times in consecutive rows? 在Excel中使用什么公式将一个单元格上丢失的文本返回到另一个单元格 - What formula to use in Excel to return missing text on one cell to another cell Excel 中的高级公式/基于另一个单元格向单元格添加文本 - Advanced formula in Excel / Adding text to a cell based on another cell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM