How to use Lambda so the if statement is it's own test condition without rewriting if statement in google sheets

Advertisements

This is a general question based not on specific formula – but I couldn’t find an answer to it anywhere – but it seems like it should be possible.
In this screenshot, you, Y and X are the same for the sake of example (there is a slight difference, but for example’s sake – let’s assume it’s the same).
enter image description here

In the formula, the same formula is used in an if statement to determine if we should move forward with actually calculating the formula. Is there a way to use lambda not to repeat the formula?

>Solution :

yes you may condense it to something in the sorts of:

=lambda(X,if(X>0,X,0))(*FORMULA*)

a generalized example in the screenshot:

Leave a ReplyCancel reply