Reputation: 31
I have been learning that certain IF statements can be converted into a form that involves only max/min. Some examples include:
IF ( x > y , x , y ) === MAX ( x , y )
IF ( x < 0 , x , 0 ) === MIN ( x , 0 )
IF ( x * y > L, L, x * y ) === MIN ( x * y, min_value )
One more complicated example includes:
IF ( IF (x > y , x , y) > z , z , IF (x > y , x , y )) === MIN ( MAX ( x , y ) , z )
Consider the following excel formulas,
IF ( x > y , x , 0 )
or
IF ( x < y , x , 0 )
Can the following formulas be converted into a form involving only max and min? If not, is there a process that I can use to deduce that an if statement cannot be converted into this form?
Upvotes: 0
Views: 38
Reputation: 259
Not to my knowledge.
IF ( x > y , x , y ) === MAX ( x , y )
is basically what MAX
may be doing behind the scenes. I don't think IF ( x < y , x , 0 )
can be accomplished with MAX
, because MAX
only returns the same arguments that it calculates, whereas IF
returns other values (which you can supply with the compared values, as you did)
Upvotes: 1