EXCEL基于日期的多重条件

时间:2018-01-16 18:27:32

标签: excel

s.DATE       E.DATE      NAME        E VALUE     DAILY  s.year       Fin. 
20-Oct-17   19-Oct-19   SHABEER 2    3,210.00    4.41   1-Sep-17    31-Aug-18
26-Sep-17   25-Sep-19   ALIKOYA 2    3,220.00    4.42   1-Sep-17    31-Aug-18

=IF(AND(B2<H2),E2-(B2-G2)*F2,"")&IF(AND(A2>G2),E2-(H2-A2)*F2,"")&IF(AND(A2<G2),E2-(H2-G2)*F2,"")&IF(AND(A2=G2),E2-(H2-A2)*F2,"")

我正在使用此公式根据日期查找值。我想如果第一个条件为真(IF(AND(B2<H2),E2-(B2-G2)*F2,"")停止通过下一个条件

谢谢

1 个答案:

答案 0 :(得分:0)

嵌套IF并且@BarryHoudini声明AND是多余的:

=IF(B2<H2,E2-(B2-G2)*F2,IF(A2>G2,E2-(H2-A2)*F2,IF(A2<G2,E2-(H2-G2)*F2,IF(A2=G2,E2-(H2-A2)*F2,""))))