我有两个单独的单独的语句
=IF(C6=1,(IFERROR(HLOOKUP(C4,list1,IF(C5"apple",2,IF(C5="orange",3,
IF(C5="plum",4,IF(C5="grape",5,IF(C5="banana",6,"")))))),"")))
和
=IF(C6=2,(IFERROR(HLOOKUP(C4,list2,IF(C5"apple",2,IF(C5="orange",3,
IF(C5="plum",4,IF(C5="grape",5,IF(C5="banana",6,"")))))),"")))
但是当我将它们组合成if语句时,
=IF(C6=1,(IFERROR(HLOOKUP(C4,list1,IF(C5="apple",2,IF(C5="orange",3,
IF(C5="plum",4,IF(C5="grape",5,IF(C5="banana",6,"")))))),""))),
IF(C6=2,(IFERROR(HLOOKUP(C4,list2,IF(C5="apple",2,IF(C5="orange",3,
IF(C5="plum",4,IF(C5="grape",5,IF(C5="banana",6,"")))))),"")))
数据看起来像这样
我得到'#Value!'错误,括号似乎已到位,不确定是什么导致此错误。
答案 0 :(得分:1)
好的,您需要在HLOOKUP function,LOOKUP function amd CHOOSE function上阅读。
此公式遵循您的样本公式的规则(例如它们),并且应该通过避免重复来简化问题。请注意,"apple","banana","grape","orange","plum"
按字母顺序排列。
=IFERROR(HLOOKUP(C4, CHOOSE(C6, List1, List2, List1),
LOOKUP(C5, {"apple","banana","grape","orange","plum"}, {2,6,5,3,4}),
FALSE), "")
如果您需要更多帮助,请编辑原始问题以包含样本数据和预期结果。