SOLVED

# 为什么这么写if函数会出错

Occasional Contributor

10 Replies

# Betreff: Why does writing the if function make an error like this

I want this formula to judge twice, the first time: whether it is less than 500. The second time, whether it is between 500 and 2000. In the second judgment, the result of whether have "500<=" is different.Why is the result of cell B2 different from the result of cell C2?

I input 1200 into A2 and A3, input     =IF(A2<500,0,IF(500<=A2<2000,A2*0.1,A2*0.2))   into  B2,and the result is 240.

I input      =IF(A3<500,0,IF(A3<2000,A3*0.1,A3*0.2))   into B3 and the result is 120.

I feel very sorry, I have to use Google Translate, the English translation may be a bit strange.

Thanks!

best response confirmed by lyt77-_ (Occasional Contributor)
Solution

# Betreff: Why does writing the if function make an error like this

@lyt77-_  Condition in second IF always returns FALSE

500<=A2<2000  => TRUE<2000  => FALSE  (logical value, as any text, always more than any number in logical operations)

Alternative formula:

``=A2*LOOKUP(A2,{0,500,2000},{0,0.1,0.2})``

# Betreff: 为什么这么写if函数会出错

@Nikolino

Thank you! you really help me a lot.

Wish you good health and good luck!Good mood every day!

# Betreff: Why does writing the if function make an error like this

Thanks a lot! I understand.
Wish you no troubles in your life!

# Betreff: Why does writing the if function make an error like this

@lyt77-_ you are welcome and take care