如何简化两个工作表之间的if公式条件语句

时间:2016-08-26 11:28:09

标签: excel

我在两张纸之间有一个IF()公式条件语句。有人会帮我简化吗?

=IF(AND(I2="P1",G2<1000),(AF2*Rating!$C$12)/100,
IF(AND(DATA!I2="P1",DATA!G2=1000),(DATA!AF2*Rating!$D$12)/100,
IF(AND(DATA!I2="P1",DATA!G2>1000),(DATA!AF2*Rating!$D$12)/100,
IF(AND(DATA!I2="P1",DATA!G2<1500),(DATA!AF2*Rating!$D$12)/100,
IF(AND(DATA!I2="P1",DATA!G2=1500),(DATA!AF2*Rating!$E$12)/100,
IF(AND(DATA!I2="P1",DATA!G2>1500),(DATA!AF2*Rating!$E$12)/100,
IF(AND(I2="P2",G2<1000),(AF2*Rating!$C$14)/100,
IF(AND(DATA!I2="P2",DATA!G2=1000),(DATA!AF2*Rating!$D$14)/100,
IF(AND(DATA!I2="P2",DATA!G2>1000),(DATA!AF2*Rating!$D$14)/100,
IF(AND(DATA!I2="P2",DATA!G2<1500),(DATA!AF2*Rating!$D$14)/100,
IF(AND(DATA!I2="P2",DATA!G2=1500),(DATA!AF2*Rating!$E$14)/100,
IF(AND(DATA!I2="P2",DATA!G2>1500),(DATA!AF2*Rating!$E$14)/100,
IF(AND(I2="P3",G2<1000),(AF2*Rating!$C$16)/100,
IF(AND(DATA!I2="P3",DATA!G2=1000),(DATA!AF2*Rating!$D$16)/100,
IF(AND(DATA!I2="P3",DATA!G2>1000),(DATA!AF2*Rating!$D$16)/100,
IF(AND(DATA!I2="P3",DATA!G2<1500),(DATA!AF2*Rating!$D$16)/100,
IF(AND(DATA!I2="P3",DATA!G2=1500),(DATA!AF2*Rating!$E$16)/100,
IF(AND(DATA!I2="P3",DATA!G2>1500),(DATA!AF2*Rating!$E$16)/100,
IF(AND(I2="P4",G2<1000),(AF2*Rating!$C$18)/100,
IF(AND(DATA!I2="P4",DATA!G2=1000),(DATA!AF2*Rating!$D$18)/100,
IF(AND(DATA!I2="P4",DATA!G2>1000),(DATA!AF2*Rating!$D$18)/100,
IF(AND(DATA!I2="P4",DATA!G2<1500),(DATA!AF2*Rating!$D$18)/100,
IF(AND(DATA!I2="P4",DATA!G2=1500),(DATA!AF2*Rating!$E$18)/100,
IF(AND(DATA!I2="P4",DATA!G2>1500),(DATA!AF2*Rating!$E$18)/100,0))))))))))))))))))))))))

3 个答案:

答案 0 :(得分:0)

你可以在VBA中写一个案例,由Brian写的。

您还可以使用命名范围来使整个事情更容易阅读(当然还有短名称)。

答案 1 :(得分:0)

这有帮助,但它仍然是一个荒谬的长公式。使用VBA!

=IF(AND(I2="P1",G2<1000),(AF2*Rating!$C$12)/100,
IF(AND(DATA!I2="P1",DATA!G2>=1000,DATA!G2<1500),(DATA!AF2*Rating!$D$12)/100,
IF(AND(DATA!I2="P1",DATA!G2>=1500),(DATA!AF2*Rating!$E$12)/100,
IF(AND(I2="P2",G2<1000),(AF2*Rating!$C$14)/100,
IF(AND(DATA!I2="P2",DATA!G2>=1000,DATA!G2<1500),(DATA!AF2*Rating!$D$14)/100,
IF(AND(DATA!I2="P2",DATA!G2>=1500),(DATA!AF2*Rating!$E$14)/100,
IF(AND(I2="P3",G2<1000),(AF2*Rating!$C$16)/100,
IF(AND(DATA!I2="P3",DATA!G2>=1000,DATA!G2<1500),(DATA!AF2*Rating!$D$16)/100,
IF(AND(DATA!I2="P3",DATA!G2>=1500),(DATA!AF2*Rating!$E$16)/100,
IF(AND(I2="P4",G2<1000),(AF2*Rating!$C$18)/100,
IF(AND(DATA!I2="P4",DATA!G2>=1000,DATA!G2<1500),(DATA!AF2*Rating!$D$18)/100,
IF(AND(DATA!I2="P4",DATA!G2>=1500),(DATA!AF2*Rating!$E$18)/100))))))))))))

答案 2 :(得分:0)

尝试一下:

=DATA!AF2 *  IF(DATA!G2<1000,INDEX(DATA!C:C,(RIGHT(DATA!I2,1)*2)+10),IF(DATA!G2<1500,INDEX(DATA!D:D,(RIGHT(DATA!I2,1)*2)+10),INDEX(DATA!E:E,(RIGHT(DATA!I2,1)*2)+10)))/100