条件第一个参数的返回值,而无需重新计算
我知道我可以通过使用单独的单元格并使其不可见解决,但我想为此提供干净的解决方案,只使用1个单元格和1个公式。
对于此示例,我需要在x.00
和y.00
(带小数)之间获得一个随机数,但不低于0.00
而不是优于9.00
。但是对于此示例,我仅使用1条条件来避免小于0.00
简化的值。
我将使用randbetween()
。 x
和y
由虚拟文件上的其他两个单元格提供:b3
和d3
。
有时随机数可以小于0.00
或更高的9.00
的原因是我需要随机结果在随机+/- 1之间,而不是(x) +y)/2
。
x
和y
值将有所不同。有时x
将为3.54
,有时8.99
,对于y
而言。对于情况时,发生x
和y
是一个低号码,例如0.5
randbetween()
函数可能会输出负数。因此,我需要输出为0.00
。对于高值相同。如果X
和y
将接近9.00
结果可能是9.35
。在这种情况下,我需要输出为9.000
。但是在下面的公式中,我仅使用低于零的情况来使其简单。
因此,我无法解决的问题是,我需要在不重新计算的情况下获得}
条件的拳头参数的值。如果我参考false
的第三参数,那么我将重新计算。我的公式是:
=IF(
(RANDBETWEEN(
((((B3*100)+(D3*100))/2)-100),
((((B3*100)+(D3*100))/2)+100))
/100)<0,0,
(RANDBETWEEN(
((((B3*100)+(D3*100))/2)-100),
((((B3*100)+(D3*100))/2)+100))
/100))
因此,这将检查第一个参数是否小于0.00
,如果是显示0.00
如果不是,则再次重新计算,这是一个问题,因为它有时可能会重新计算小于0.00
的值。
我的问题是:有没有办法返回条件的第一个论点的价值,而无需重新计算randbetween()
且不使用单独的单元格?
如果不可能,我也欢迎使用自定义气体功能进行任何解决方案。
我的虚拟文件:
https://docs.google.com/spreadsheets/d/15ytguvqdtuc-ramnjin-yg4j3uraorxdpiwty_kb_kb_k0/edit
(单击复选框重置,然后再次重新计算随机数)。
I know I can solve it by using a separate cell and make it invisible but I'd like a clean solution for this and use only 1 cell and 1 formula.
For this example I need to get a random number between X.00
and Y.00
(with decimals), not lower than 0.00
and not superior than 9.00
. But for this example I am using only 1 condition for avoiding values less than 0.00
to simplify.
I will use RANDBETWEEN()
. The X
and Y
are supplied by 2 other cells on the dummy file bellow: B3
and D3
.
The reason why sometimes the random number can be less than 0.00
or above 9.00
is that I need the random result to be between random +/- 1 than (X+Y)/2
.
Also X
and Y
values will vary. Sometimes X
will be 3.54
, sometimes 8.99
and same for Y
. For situations when it happens that X
and Y
are a low number like 0.5
the RANDBETWEEN()
function might output a negative number. When so I need the output to be 0.00
. Same for high values. If both X
and Y
will be close to 9.00
the result might be something like 9.35
. In this cases I´d need the output to be 9.000
. But in the below formula I am only using cases below zero to make it simple.
So the problem I am unable to resolve is that I need to get the value of the fist argument of the ÌF()
condition without recalculating it. If I refer to the 3rd argument for FALSE
then I will recalculate. my formula is this:
=IF(
(RANDBETWEEN(
((((B3*100)+(D3*100))/2)-100),
((((B3*100)+(D3*100))/2)+100))
/100)<0,0,
(RANDBETWEEN(
((((B3*100)+(D3*100))/2)-100),
((((B3*100)+(D3*100))/2)+100))
/100))
So this will check if the first argument is less than 0.00
, if it is it displays 0.00
if not it recalculates again and this is a problem because it might sometimes recalculate a value less than 0.00
.
My question is: Is there a way to return the value of the first argument of the condition without recalculation of RANDBETWEEN()
and without using a separate cell?
If not possible I would also welcome any solution using custom GAS functions.
My dummy file:
https://docs.google.com/spreadsheets/d/15YtgUVqDTuC-raMNJiN-YG4j3URaorXdPiwTy_Kb_K0/edit
(click checkbox to reset and again to recalculate the random number).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将您的
randbetween Thook Thook Thook Thook Tooker
在min
-max
中Wrap your
RANDBETWEEN
within aMIN
-MAX