Tell me, please, how to make a formula for meeting the condition: if the cell value is less than 90, then the result is A, if it is more than 90, but less than 180, then - B, if more than 180, but less than 270, then C, otherwise - D.

I tried the formula =袝小袥袠(袗1<90;"袗";袝小袥袠(袗1>270;"D")) - but this is only for extreme conditions. Perhaps, it is possible to use the logical operators AND, OR, and so on?

    2 answers 2

    Since the lower boundary conditions are checked in the previous functions, some checks can be removed. If the number does not need to show the text, quotes are also superfluous:

     =袝小袥袠(A2<90;1;袝小袥袠(A2<180;2;袝小袥袠(A2<270;3;4))) 

    Options:

     =袩袪袨小袦袨孝袪(A2;{0;90;180;270};{1;2;3;4}) =袙袩袪(A2;{0;1:90;2:180;3:270;4};2;1) 

    It seems that the sectors of the circle are considered and more than 360 will not. In this case, you can:

     =袙蝎袘袨袪(A2/90+1;1;2;3;4;4) =袦袠袧(笑袝袥袨袝(A2/90)+1;4) 

    The work of CDF with a range of constants is described here:

    use of a range of constants in the CDF function

      Already realized

       =袝小袥袠(袠(袗2>=0;袗2<90);"1";袝小袥袠(袠(袗2>=90;袗2<180);"2";袝小袥袠(袠(袗2>=180;袗2<270);"3";"4"))) 
      • alexnik, read the previous answer: in your formula, extra checks, you can optimize. - vikttur
      • Thank you very much! It was useful and very (; - user19222