简体   繁体   中英

Excel Nested IF Statement Trouble

=IF(J4 >= 20, A, IF(J4 < 20 AND J4 > 13, B, IF(J4 < 14 AND J4 > 8, C, IF(J4 < 8, D,0))))

The numeric values = points The values A - D is a scoring systems that rates a person based upon their points and gives them a value from AD.

I've been stuck on this formula for a long time and have no idea what I'm doing wrong, all help would be appretiated!

You may consider to update your statement as follows.

=IF(J4<8,"D",IF(J4<14,"C",IF(J4<20,"B","A")))

You can see that it's important in this case to move in one direction, either low to high , or high to low . This allows us to return a result whenever a test returns TRUE, because we know that the previous tests have returned FALSE.

尝试这个:

=IF(J4 >= 20, "A", IF(J4 > 13, "B", IF(J4 > 8, "C", "D")))

这是一个公式:

=IF(20<=J4,"A",IF(13<=J4,"B",IF(8<=J4,"C",IF(J4<8,"D",0))))

I think the syntax you're using for the AND function is wrong. You need to nest all the parameters you want to use within the AND function. like this:

=IF(AND(J4<20,J4>8),"true","false")

Another apporach assuming that the possible inputs in J4 are integers below 1000:

=IFERROR(INDEX({"A";"B";"C";"D"},MATCH(J4,{1000;19;12;7},-1)),0)

I think this one is easier to read and to maintain.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM