Forum Discussion
Vito DiMercurio
Oct 24, 2017Copper Contributor
Excel If then else support
Hey everyone, I'm having trouble finding the right syntax for an excel if/else/than formula in a spread sheet. I think I have all the individual parts, but putting it together is stumping me. Let...
- Oct 25, 2017
Hello,
you can use this formula in cell A3
=A1-A2+IF(WEEKDAY(A1-A2)=1,1,IF(WEEKDAY(A1-A2)=7,-1,0))
Then you can use conditional formatting on cell A3 with a rule that uses a formula. Either use one rule for both Saturday and Sunday adjustments with the formula
=or(WEEKDAY(A1-A2)=1,WEEKDAY(A1-A2)=7)
or use one rule for Sunday with one color, and another rule for Saturday with another colour.
=WEEKDAY(A1-A2)=1 -- sunday rule, use green
=WEEKDAY(A1-A2)=7 -- saturday rule, use red
Does that help?
SergeiBaklan
Oct 25, 2017Diamond Contributor
Perhaps no practical sense, just my exercise with "no IF" formula
=A1-A2+LOOKUP(MOD((A1-A2)/7,1)*7,{0,0.9,1.5},{-1,1,0})