我正在使用Excel工作表来验证数据。这是对支付金额与最低可用成本的相对简单的验证。根据某些逻辑,每条记录都附有一个代码,以解释为什么没有使用最低可用成本等等。
在我的工作表列中,我表示已付款金额,J表示最低可用成本,K表示项目/服务的最高已知成本。列Q包含代码(例如CC,LL,BC等)。
这是我目前使用的公式:
=IF(OR(AND(J2=I2,H2<>"ZZ",Q2="LL"),AND(J2=I2,H2<>"ZZ",Q2="EX"),AND(J2=I2,H2<>"ZZ",Q2="ER"),AND(J2=I2,H2<>"ZZ",Q2="EV"),AND(J2=I2,H2<>"ZZ",Q2="CD"),AND(J2<I2,H2<>"ZZ",Q2={"BB","BC","CC","CD","DD","FF","QQ","RR","XA","XC"})),"Good","Error")
最后一部分不能始终如一地运作:
AND(J2<I2,H2<>"ZZ",Q2={"BB","BC","CC","CD","DD","FF","QQ","RR","XA","XC"})
例如,我有一条线,其中J2小于I2,Q2 = RR,当它真的应该是“好”时会产生“错误”。
任何建议或帮助将不胜感激。谢谢!
答案 0 :(得分:2)
将数组部分包装在OR()
:
AND(J2<I2,H2<>"ZZ",OR(Q2={"BB","BC","CC","CD","DD","FF","QQ","RR","XA","XC"}))