在电子表格的一栏中,我有值: A,B,C,D,E,F,G,H,I,J,K :
A in rows 1-4,
B in rows 5-9,
C in rows 10-19,
D in rows 20-49,
E in rows 50-99,
F in rows 100-249,
G in rows 250-499,
H in rows 500-999,
I in rows 1,000-4,999,
J in rows 5,000-9,999,
K in rows 10,000+
我正在使用以下功能:
=IF(OR(G2={""}), "", IF(OR(G2={"A"}), "1-4", ""), IF(OR(G2={"B"}), "5-9", ""), IF(OR(G2={"C"}), "10-19", ""), IF(OR(G2={"D"}), "20-49", ""), IF(OR(G2={"E"}), "50-99", ""), IF(OR(G2={"F"}), "100-249", ""), IF(OR(G2={"G"}), "250-499", ""), IF(OR(G2={"H"}), "500-999", ""), IF(OR(G2={"I"}), "1000-4999", ""), IF(OR(G2={"J"}), "5000-9999", ""), IF(OR(G2={"K"}), "10000", ""))
我收到一条错误,指出"您为此功能输入了太多参数"。
我哪里失败了?
当我运行以下内容时,我没有收到错误:
=IF(OR(G2={""}), "", IF(OR(G2={"A"}), "1-4", ""))
但是当我添加另一行时,如下所示:
=IF(OR(G2={""}), "", IF(OR(G2={"A"}), "1-4", ""), IF(OR(G2={"B"}), "5-9", ""))
我收到错误。
如何避免此错误?
答案 0 :(得分:2)
IF()
语法是
=if(condition, true result, false result)
你没有那个。你在做什么
=if(condition, true result, false result, other result 1, other result 2, etc...)
这是一个语法错误。如果你想像这样链接IF(),你需要一些像
这样的东西 =if(condition, true result, IF(othercondition, true result, IF(...)))
1 2 3 321
注意括号编号。
答案 1 :(得分:1)
您的示例中不需要OR
,并且当您包含其他,""
时,您需要摆脱IF
:
=IF(G2={""}, "", IF(G2={"A"}, "1-4", IF(G2={"B"}, "5-9", "")))
整个事情(你在B测试后做了同样的错误):
=IF(G2={""},"",IF(G2={"A"},"1-4",IF(G2={"B"},"5-9",IF(G2={"C"},"10-19",IF(G2={"D"},"20-49",IF(G2={"E"},"50-99",IF(G2={"F"},"100-249",IF(G2={"G"},"250-499", IF(G2={"H"},"500-999" ,IF(G2={"I"},"1000-4999" ,IF(G2={"J"},"5000-9999", IF(G2={"K"},"10000",""))))))))))))
答案 2 :(得分:0)
您的第一个IF
声明中有太多参数。试试这样的事情
=IF(OR(G2={""}), "", IF(OR(G2={"A"}), "1-4", IF(OR(G2={"B"}), "5-9", "")))