如何将求解器'Value of'设置为单元格引用

时间:2020-12-27 02:28:16

I'm working on a project where I have to calculate an end price based on a specific number with the price per item changing to equal said end price (see example image below).

我正在开展一个项目,我必须根据特定的数字计算最终价格,每个项目的价格变为等于所述最终价格(参见下面的示例图片)。

如何将求解器'Value of'设置为单元格引用

However, I was curious if there is any possible way to run solver for multiple lines (like a formula) with the 'Value of' number being a cell reference instead of a static number.

但是,我很好奇是否有任何可能的方法为多行(如公式)运行求解器,其中'Value of'数字是单元格引用而不是静态数字。

Is this possible? Please let me know if more info is needed.

这可能吗?如果需要更多信息,请告诉我。

1 个解决方案

#1


0  

Record a macro and take a look at the generated code. Then it would have something like this within:

记录一个宏并查看生成的代码。然后它会有这样的内容:

SolverOk SetCell:="$D$3", MaxMinVal:=3, ValueOf:=Y.Value, ByChange:="$D$2"

Try to change the ValueOf=: to Range("F2") and run it again.

尝试将ValueOf =:更改为Range(“F2”)并再次运行它。

#1


0  

Record a macro and take a look at the generated code. Then it would have something like this within:

记录一个宏并查看生成的代码。然后它会有这样的内容:

SolverOk SetCell:="$D$3", MaxMinVal:=3, ValueOf:=Y.Value, ByChange:="$D$2"

Try to change the ValueOf=: to Range("F2") and run it again.

尝试将ValueOf =:更改为Range(“F2”)并再次运行它。