Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Trying to use a Variable to change sheets when a timer hits a certain amount of seconds. Written this IF statement which comes out "ok" as an expression, but only the first condition works. The 0 or 1. Not the condition for 2, 3, 4, 5 etc. Any ideas? Probably something simple I've overlooked.
= |
if(vTimerSec >= 5, 1,
if(vTimerSec >= 10, 2, |
if(vTimerSec >= 15, 3, | |
if(vTimerSec >= 25, 4, | |
if(vTimerSec >= 35, 5 |
,0)))))
Try
If (vTimerSec >= 35, 5,
If (vTimerSec >= 25, 4,
If (vTimerSec >= 15, 3,
If (vTimerSec >= 10, 2,
If (vTimerSec >= 5, 1,
0))))) ;
All of the conditions you have listed are > 5, so only the first line is actioned.
It works as supposed, because >=10 is also >=5 and so on...
Try
If (vTimerSec >= 35, 5,
If (vTimerSec >= 25, 4,
If (vTimerSec >= 15, 3,
If (vTimerSec >= 10, 2,
If (vTimerSec >= 5, 1,
0))))) ;
try ascending order ...he ranges 35 to 5
Hi Ali,
Can you please try below and let me know if it works.
if(vTimerSec >= 5 and vTimerSec < 10, 1,
if(vTimerSec >= 10 and vTimerSec < 15, 2,
if(vTimerSec >= 15 and vTimerSec < 25, 3,
if(vTimerSec >= 25 and vTimerSec < 35, 4,
if(vTimerSec >= 35, 5
,0)))))
Thanks,
Sreeman.
That will work, but if you apply the test against the largest value first and the rest in descending order you only need to test for one condition on each row not two tests.
Thanks for the help Colin and Sreeman! Really appreciate it. Such a easy twist to it made it work