multiple excel if statements to produce value 1,2 or 3

后端 未结 3 1624
抹茶落季
抹茶落季 2020-12-07 06:06

I am trying to find out the right if statement to use for this task:

if B5 is higher than C5 = 1
if B5 is within 2% higher than C5 = 2
if B5 is lower than C5         


        
3条回答
  •  天命终不由人
    2020-12-07 06:40

    You can nest IF formulae:

    =IF(condition2, 2, IF(condition1, 1, IF(condition3, 3, "error!")))
    

    With your conditions, it looks something like:

    =IF(AND(B5>(C5-(C5*2/100)), B5<(C5+(C5*2/100))), 2, IF(B5>C5, 1, 3))
    

提交回复
热议问题