Forum Discussion

vinedancer's avatar
vinedancer
Copper Contributor
Oct 07, 2022
Solved

Function IF

I have 2 IF formulas, both working fine on their own. However I want to combine them - will try to put into words what I need the formula to do.

 

IF O12 is between 22 and 24, then O12-22 otherwise nil, but IF O12 equals 24, then 2, otherwise nil

 

=IF(OR(O12>22,O12<24),O12-22,0)

=IF(O12=24,2,0)

 

Thanks 🙂

  • vinedancer Hi,
    your first formula should use AND instead of OR
    to join them together you can consider nested IF statement
    =IF(AND(O12>22,O12<24),O12-22,IF(O12=22,2,0))

2 Replies

  • Sampi314's avatar
    Sampi314
    Copper Contributor

    vinedancer Hi,
    your first formula should use AND instead of OR
    to join them together you can consider nested IF statement
    =IF(AND(O12>22,O12<24),O12-22,IF(O12=22,2,0))

Resources