Originally Posted by

**dirkgeraedts**
Hey Ryan,

Good job figuring out yourself, however i think your formula contains still contains two errors:

1. first, your formula doesn't account for the fact that some days there might be a 0 loss/gain. in some of your conditions use signs as "<="(smaller or equal to) or ">="(greater or equal to) instead of < and > otherwise you'll miss possible outcomes. This is probably also what is causing the error on your first line of data because its previous day is probably 0.

2. in the first IF formula you take 19.95 to the power of 2 (=19.95*19.95) instead of multiplying it by 2 as in your initial example. Is this correct? If not, change it to 19.95*2.

Finally i have shortened the formula you wrote down above in case you're interested.

=IF(AND(N4>0,N3<0,N5<0),(B4+(B4*(N4/100)))-(19.95*2),IF(AND(N4>0,OR(N3<0,N5<0)),(B4+(B4*(N4/100)))-(19.95),(B4+(B4*(N4/100)))))

Good luck,

Dirk

## Like this thread? Share it with others