如果功能-多个条件

时间:2019-04-05 14:40:19

标签: excel-formula

我需要最终输出基于前4列的值

我的表格有6列(A-F)。 B-E列上的值取决于值A。最终输出结果取决于前4列B-E上的值。

A = has some value
B - E : lookup value and dependent on A. Can be NA or value related to A

条件:

If B is not NA, then B value on F

If B is NA, check C,D,E

If C is not NA, Then C value on F

If C is NA, CHECK D,E

If D is not NA, then D value on F

If D is NA, Then Check E

If E is not NA, Then E value on F

If NA, then Value on F = NA

尝试“如果”和“或”但出现错误。

  

IF(B2 <>“#N / A”,B2,IF(C2 <>“#N / A”,C2,IF(D2 <>“#N / A”,D2,IF(E2 <> “#N / A”,“ REIN”,“ NA”))))))

将值作为E2作为REIN作为值

3 个答案:

答案 0 :(得分:0)

尝试将其输入单元格F2

out <- read.csv(text = sub("(\\d{2})$", ",\\1", df1[[1]]), header = FALSE,
       col.names = c("month", "day"), stringsAsFactors = FALSE)

head(out, 5)
#  month day
#1    12  31
#2    12  31
#3    12  31
#4    12  31
#5     2   2

答案 1 :(得分:0)

将此内容放入F2:

=INDEX(B2:E2,MATCH(TRUE,INDEX(NOT(ISNA(B2:E2)),),0))

它将返回没有错误的第一个单元格。

enter image description here

答案 2 :(得分:0)

好的-事实证明这是相当棘手的。将此输入到F2中:= IF(IF(OR(IFNA(B2,1)=“ NA”,IFNA(B2,1)= 1),“ NA”,B2)=“ NA”,IF(IF(OR( IFNA(C2,1)=“ NA”,IFNA(C2,1)= 1),“ NA”,C2)=“ NA”,IF(IF(OR(IFNA(D2,1)=“ NA”,IFNA (D2,1)= 1),“ NA”,D2)=“ NA”,IF(IF(OR(IFNA(E2,1)=“ NA”,IFNA(E2,1)= 1),“ NA” ,E2)=“ NA”,“ NA”,E2),D2),C2),B2)

我前段时间在评论中提供了此答案,但不确定您是否看到了它。

相关问题