Forum Discussion

Jenny_053's avatar
Jenny_053
Copper Contributor
Jul 21, 2022
Solved

Excel - ifs + and/ or condition, didn't function

Hi there, 

 

I am trying setting up the function of ifs + or / and. However, excel didn't show the correct answer as expected. 

 

=IFS(OR(B14>0,C14>=6),"A",AND(B14=0,5>=C14>=3),"B",AND(B14=0,C14<=2),"C")

It should show "C" instead of "B" when B14 and C14 both equal to 0. 

Does anyone how to fix it? Thanks so much!

 

 

  • Jenny_053  wrote:

    ``=IFS(OR(B14>0,C14>=6),"A",AND(B14=0,5>=C14>=3),"B",AND(B14=0,C14<=2),"C")``

     

    The syntax 5>=C14>=3 is not valid.  And it is redundant if the values in C14 are only integers that are zero or more.

     

    Also, the condition B14=0 is redundant if the values in B14 are only integers that are zero or more.

     

    OTOH, if B14<0 is possible, you are not covering all the conditions.

     

    So assuming B14<0 is not possible, your formula can be:

     

    =IFS(OR(B14>0,C14>=6), "A", C14>=3, "B", TRUE, "C")

     

  • JoeUser2004's avatar
    JoeUser2004
    Bronze Contributor

    Jenny_053  wrote:

    ``=IFS(OR(B14>0,C14>=6),"A",AND(B14=0,5>=C14>=3),"B",AND(B14=0,C14<=2),"C")``

     

    The syntax 5>=C14>=3 is not valid.  And it is redundant if the values in C14 are only integers that are zero or more.

     

    Also, the condition B14=0 is redundant if the values in B14 are only integers that are zero or more.

     

    OTOH, if B14<0 is possible, you are not covering all the conditions.

     

    So assuming B14<0 is not possible, your formula can be:

     

    =IFS(OR(B14>0,C14>=6), "A", C14>=3, "B", TRUE, "C")

     

Resources