I often use REPT in place of an IF where I need the text value only if TRUE.
Question: Does REPT evaluate the text argument only if the number_times is TRUE, or does it evaluate the arguments in order? Why does this matter? Let's say I have a formula that looks like this:
=REPT(intense_formula_that_returns_text, intense_condition_that_returns_boolean)
If Excel evaluates number_times first, and only evaluates the text argument if TRUE, this is a sensible formula. However, if Excel evaluates from left to right, so that, even before it gets to the number_times condition, this is wasteful, and I'm better off using an IF, which will not evaluate the value_if_true, if the test failed.
I see that Evaluate Formula does evaluate the text argument first, but, is this proof positive that this is, in fact, how Excel evaluates REPT for real?
Thank you!
Question: Does REPT evaluate the text argument only if the number_times is TRUE, or does it evaluate the arguments in order? Why does this matter? Let's say I have a formula that looks like this:
=REPT(intense_formula_that_returns_text, intense_condition_that_returns_boolean)
If Excel evaluates number_times first, and only evaluates the text argument if TRUE, this is a sensible formula. However, if Excel evaluates from left to right, so that, even before it gets to the number_times condition, this is wasteful, and I'm better off using an IF, which will not evaluate the value_if_true, if the test failed.
I see that Evaluate Formula does evaluate the text argument first, but, is this proof positive that this is, in fact, how Excel evaluates REPT for real?
Thank you!
Last edited: