Formula to generate a value according to a range

吃可爱长大的小学妹 提交于 2019-12-02 14:01:32

Assuming 16 is "between" 16-20 rather than "between" 12-16 and that for N it is the text of the OP that counts rather than the image:

=LOOKUP(A1,{12,16,20,24},{-2,-1,"N"})  

Negative values, zero, numbers less than 12 and positive or greater than 24, blanks and text would return #N/A.

LOOKUP.

You could do it like this (place this formula in B1):

=IF(AND(A1>=12;A1<=15);"-2";IF(AND(A1>=16;A1<20);"-1";IF(AND(A1>=20;A1<25);"N";"N/A")))
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!