我正在尝试在excel中使用IF和AND函数获取两个不同单元格中的值。我有25个条件。
下面是我创建的公式,但它一直在说有错误。
IF(AND(A10 =“ A”,B10 = 1),11,IF(AND(A =“ A”,B10 = 2),16,IF(AND(A10 =“ A”,B10 = 3 ),20,IF(AND(A10 =“ A”,B10 = 4),23,IF(AND(A10 =“ A”,B10 = 5),25,IF(AND(A10 =“ B”,B10 = 1),7,IF(AND(A10 =“ B”,B10 = 2),12,IF(AND(A10 =“ B”,B10 = 3),17,IF(AND(A10 =“ B”,B10,3 = 4),21,IF(AND(A10 =“ B”,B10 = 5),24,IF(AND(A10 =“ C”,B10 = 1),4,IF(AND(A10 =“ C”, B10 = 2),8,IF(AND(A10 =“ C”,B10 = 3),13,IF(AND(A10 =“ C”,B10 = 4),18,IF(AND(A10 =“ C”,B10 = 4) ,B10 = 5),22,IF(AND(A10 =“ D”,B10 = 1),2,IF(AND(A10 =“ D”,B10 = 2),5,IF(AND(A10 =“ D”,B10 = 2) ”,B10 = 3),9,IF(AND(A10 =“ D”,B10 = 4),14,IF(AND(A10 =“ D”,B10 = 5),19,IF(AND(A10 =“ E”,B10 = 1),1,IF(AND(A10 =“ E”,B10 = 2),3,IF(AND(A10 =“ E”,B10 = 3),6,IF(AND(A10 = “ E”,B10 = 4),10,15 )))))))))))))))))))))))))))))))))))))))))))))))))))))) ))))))))))
我期望输出例如;如果cell1为“ A”且cell2为1,则结果应为11。
答案 0 :(得分:0)
我强烈建议您使用查询表。只需列出所有选项及其所需结果,然后通过标准搜索(例如使用sumifs
函数)即可找到它们。
例如,如果您粘贴J1:L25,那么您的可能性:
A 1 11
A 2 16
A 3 20
A 4 23
A 5 25
B 1 7
B 2 12
B 3 17
B 4 21
B 5 24
C 1 4
C 2 8
C 3 13
C 4 18
C 5 22
D 1 2
D 2 5
D 3 9
D 4 14
D 5 19
E 1 1
E 2 3
E 3 6
E 4 10
E 5 15
然后可以放置公式=SUMIFS($L$1:$L$25,$J$1:$J$25,$A$10,$K$1:$K$25,$B$10)
以返回所需的值。
也就是说,=SUMIFS(range_of_results, criteria_range_of_A-E, A10, criteria_range_of_1-5, B10)