'combine more IF(OR Google sheet formula

I have this problem , in a google sheet's cell I have put inside this formula:

=IF(OR(AND(F21>"01/05/2022";F21<"31/05/2022");AND(G21=2;));$J$4;"errore");

and this run correctly. but now I would combine this formula with another in the same cell i.e.

=IF(OR(AND(F21>"01/05/2022";F21<"31/05/2022");AND(G21=2;));$J$4;"errore");IF(OR(AND(F21>"01/06/2022";F21<"30/06/2022");AND(G21=3;));$K$4;"errore");

could you help me to made this without errore please? thanks a lot



Solution 1:[1]

try:

=IF(OR(AND(F21>"01/05/2022"; F21<"31/05/2022"); G21=2); $J$4; 
 IF(OR(AND(F21>"01/06/2022"; F21<"30/06/2022"); G21=3); $K$4; "errore"))

or for array:

=INDEX(IF((MONTH(F21:F)=5)+(G21:G=2); J4;
       IF((MONTH(F21:F)=6)+(G21:G=2); K4; "errore")))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 player0