# What is most computational demanding on the system, if statement or max formula

Hi,
I have a question, I have encountered in some of our models, where we want to limit a value to be 0 if it is negative. The way we have done this so far is by making an if statement so:

if A > 0 then A else 0.

Since Anaplan has Max, I thought this could be used, at least to make it easier to follow.

The big question is then, if it is more efficient to use the max formula, rather than creating if statement to check if it is positive or negative. So which option is the most computational demanding on the system given:

A: Need to check if another line item is positive, if not then take 0.

B: Need to check if a longer calculation is positive, if not then 0

C: Need to check if a sum from a list is positive, if not then 0.

I would imagine that the max formula would be more efficient, since it only needs to calculate once, where I imagine that the if would have to calculate first to check the statement, if that is positive then calculate it again to add the value. But would love to get better insight on this matter.

Best regards

Morten

Tagged: