有谁知道如何将 6 个类似的 Excel 公式组合在一起?

有谁知道如何将 6 个类似的 Excel 公式组合在一起?

它们单独工作都很好,但我需要它们合二为一。这可能吗?

=IF(J22='Storm L+P '!A2,VLOOKUP(V22,'Storm L+P '!$A$2:$C$11,2,0))
=IF(J22='Storm L+P '!A14,VLOOKUP(V22,'Storm L+P '!A$14:C$23,2,0))
=IF(J22='Storm L+P '!A26,VLOOKUP(V22,'Storm L+P '!A$26:C$35,2,0))
=IF(J22='Storm L+P '!A38,VLOOKUP(V22,'Storm L+P '!A$47:C$47,2,0))
=IF(J22='Storm L+P '!A49,VLOOKUP(V22,'Storm L+P '!A$49:C$59,2,0))
=IF(J22='Storm L+P '!A61,VLOOKUP(V22,'Storm L+P '!A$61:C$74,2,0))

答案1

正如评论所建议的,您应该学习如何执行嵌套 IF。

但你可能想要的是:

=IF(J22='风暴 L+P'!A2,VLOOKUP(V22,'风暴 L+P'!$A$2:$C$11,2,0),IF(J22='风暴 L+P'!A14,VLOOKUP(V22,'风暴 L+P'!A$14:C$23,2,0),IF(J22='风暴 L+P'!A26,VLOOKUP(V22,'风暴 L+P'!A$26:C$35,2,0),IF(J22='风暴 L+P'!A38,VLOOKUP(V22,'风暴 L+P'!A$47:C$47,2,0),IF(J22='风暴 L+P'!A49,VLOOKUP(V22,'风暴 L+P '!A$49:C$59,2,0),IF(J22='Storm L+P '!A61,VLOOKUP(V22,'Storm L+P '!A$61:C$74,2,0),"J22 不符合任何条件"))))))

我已经插入了"J22 does not match any of the criteria"您可以将其替换为您希望显示的任何内容,即使该单元格J22与工作表中给定的任何单元格都不匹配'Storm L+P'

答案2

您可以使用模式和 INDEX 将正确的范围返回到 VLOOKUP:

=VLOOKUP(v22,INDEX('Storm L+P '!$A:$A,MATCH(J2,'Storm L+P '!$A:$A,0)):INDEX('Storm L+P '!$C:$C,MATCH(J2,'Storm L+P '!$A:$A,0)+10),2,FALSE)

相关内容