如果不满足以下条件但 Excel 返回一个#N/A
值,我需要将单元格显示为空白。
=IF(ISBLANK(O14),"",(IF(AND(C14<>"OFF",$B$2="Week 1"),VLOOKUP(B14,Rotation!$D$64:$E$70,2,FALSE),IF(AND(C14<>"OFF",$B$2="Week 2"),VLOOKUP(B14,Rotation!$D$73:$E$79,2,FALSE),IF(AND(C14<>"OFF",$B$2="Week 3"),VLOOKUP(B14,Rotation!$D$82:$E$88,2,FALSE),"")))))
答案1
例如,如果您在 $B$2 中设置第 2 周,但在范围内未找到 B14 中给出的值Rotation!$D$73:$E$79
, Excel 将使用此公式返回 #N/A。
您可以添加一个包装器IFERROR
来检查是否根本找不到该值:
=IFERROR(IF(ISBLANK(O14),"",(IF(AND(C14<>"OFF",$B$2="Week 1"),VLOOKUP(B14,Rotation!$D$64:$E$70,2,FALSE),IF(AND(C14<>"OFF",$B$2="Week 2"),VLOOKUP(B14,Rotation!$D$73:$E$79,2,FALSE),IF(AND(C14<>"OFF",$B$2="Week 3"),VLOOKUP(B14,Rotation!$D$82:$E$88,2,FALSE),""))))),"")