ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   If statement - can it stop once a conditon is reached? (https://www.excelbanter.com/excel-worksheet-functions/236520-if-statement-can-stop-once-conditon-reached.html)

mike

If statement - can it stop once a conditon is reached?
 
Hello

Is their a way for the IF statement to stop calculating once one of
the conditions has been reached?

For example

A B C D
1 Symbol: Last: Limit: Status:
2 IBM-US 105.28 105 open


Cell D2 =IF(C2<=B2,"filled","open")

Is there a way from keeping the status from changing back
from "filled" to "open." In other words the
status can only go from "open" to "filled" and
remained as "filled" once the condition is met regardless of what
happens to either cells B2 or C2 afterwards.

Thank you

Mike

jamescox[_50_]

If statement - can it stop once a conditon is reached?
 

After you enable iterative calculations (Excel Options | Formulas |
Calculation Options | check the Enable iterative calculations checkbox)
this works - but the values in B and C have to be set before you paste
the formula into D

=IF(D4="Filled","Filled",IF(C4<=B4,"Filled","Open" ))

if a simple 'less than' rather than a 'less than or equal to' would
work, you could paste this formula into rows where the C and D cells
were blank.

In either case, when a cell refers to its own value, you are setting up
a circular calculation and the iterative calculation setting has to be
enabled.

Hope this really works the way you are expecting it to...


--
jamescox
------------------------------------------------------------------------
jamescox's Profile: http://www.thecodecage.com/forumz/member.php?userid=449
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=114686



All times are GMT +1. The time now is 10:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com