If formula with multiple condition

Hi, all,
i have a problem , Request to help me with a formula
If A1 cell contains letter C or D and B1 cell = 180 then C1 = 0 ,if 180 or 0 Not available in B1 then B1 should be copied to C1
If A1 cell contains letter C or D and B1 cell = 0 then C1 = 180 .,if 180 or 0 Not available in B1 then B1 should be copied to C1
IF sample.ods (57.4 KB)

IF_sample.ods (60.1 KB)

1 Like

Shorter with LO version >=24.8:
=LET(CD;OR(CODE($A2)=67;CODE($A2)=68);IF(AND(CD;$B2=180);0;IF(AND(CD;$B2=0);180;$B2)))
This tests if only the leftmost character is “C” or “D”. The result of this test is stored in variable CD.

1 Like

please change your straight formula with the extension in outputs of the origin string in cells [Ax] when the logics are false / NOT “C” OR “D” AND “0” OR “180” /

I don’t get what you mean.

What advantage does the function =LET() offer compared to =IFS() if I cannot use the variable name - here “CD” - globally in the sheet?

What advantage does the function =LET()

I think, it is all about readability and possibly efficiency (evaluate once). I’m still unfamiliar with LET().
=LET(CD;OR(CODE($A2)=67;CODE($A2)=68);IF(AND(CD;$B2=180);0;IF(AND(CD;$B2=0);180;$B2)))
vs.
=LET(IF(AND(OR(CODE($A2)=67;CODE($A2)=68);$B2=180);0;IF(AND(OR(CODE($A2)=67;CODE($A2)=68);$B2=0);180;$B2)))

I’m also. The link on the help-site goes actually to an empty site.
I prefer the hierarchical IFS-function with: case1, if false then case2, if false then case3, and so on.
I would like to test whether =LET() can operate with multiple variable names like a normal C+ programming, where I have to declare each variable with 1 starting value (number, character), 1 maximum value (range), 1 type (class) so that the system can work correctly.

alternativ example:
IF_sample-2_062917.ods (70.1 KB)
Have a look to the logic table on right parcelles.

Here is my favorite solution with '=IFS():
IF_sample-3_024330.ods (56.2 KB)