如何使用多个if / or参数进行vlookup

时间:2018-08-07 18:44:35

标签: excel excel-formula

目标是编写一个公式询问:

伪代码: “在列e中插入”:

if cell in column d is in column a then 1, if cell is in column b then 2, if cell is in column c then 3

首次尝试 我有一种方法可以使多达2个if语句具有以下公式: =IFERROR(IF(MATCH(B2,cell_range,0),"1",),"2");

但是我非常想添加第三个'value_if'子句。

屏幕截图

enter image description here

3 个答案:

答案 0 :(得分:3)

使用E2中的AGGREGATE并复制/向下拖动:

=AGGREGATE(15,6,COLUMN($A$2:$C$12)/($A$2:$C$12 = D2),1)

enter image description here

答案 1 :(得分:1)

尝试

=countif(a:a, d2)+countif(b:b, d2)*2+countif(c:c, d2)*3  'mutliples
=sign(countif(a:a, d2))+sign(countif(b:b, d2))*2+sign(countif(c:c, d2))*3  'singles

答案 2 :(得分:0)

您可以将其放入E2并复制下来:

=IF(ISERROR(MATCH(D2,$A$2:$A$12,0)) = FALSE, 1,IF(ISERROR(MATCH(D2,$B$2:$B$12,0)) = FALSE,2,IF(ISERROR(MATCH(D2,$C$2:$C$12,0)) = FALSE,3,"Nothing Found")))