Hello

I am trying to run a monte carlo simulation on @risk however I need to set up some constraints and I am having trouble developing the correct formula.

if the sum of a row of cells (each cell is one month) equals a value in a separate cell (call it x) I want the formula to return 0, however if the cell is lower than that value (y) I would like it to either return a desginated minimum value or x-y; whichever is lowest.

I have been trying to write an if argument however I cant complete the end of it so far it looks like this:

if(sum(g70:g70)=c$64,0 (if(sum(g70:g70)<c$64....now i want to say either return the designated minimum value or difference between c$64 and the sum of the previous months; which ever value is the lowest.

I hope my question is clear enough to understand.

Thank you for any help.