可以在Google表格的ARRAYFORMULA中使用此公式吗?

时间:2019-12-16 19:20:23

标签: if-statement google-sheets google-sheets-formula array-formulas gs-vlookup

我有一个公式,试图将其转换为ARRAYFORMULA,但未成功。由于该公式如下所示,因此工作正常,但是当我转换为ARRAYFORMULA时,它显示为空白(因为我要求该公式显示是否满足所有条件。

这是非数组公式:

    =IFERROR(IF(AND(D5="SAN BERNARDINO",K5>1,K5<1001),VLOOKUP(D5,ApprovalKey,2,FALSE),
IF(AND(D5="SAN BERNARDINO",K5>1002,K5<5001),VLOOKUP(D5,ApprovalKey,3,FALSE),
IF(AND(D5="SAN BERNARDINO",K5>5002,K5<10001),VLOOKUP(D5,ApprovalKey,4,FALSE),
IF(AND(D5="SAN BERNARDINO",K5>10002),VLOOKUP(D5,ApprovalKey,5,FALSE),
IF(AND(D5="ATLANTA",K5>1,K5<1001),VLOOKUP(D5,ApprovalKey,2,FALSE),
IF(AND(D5="ATLANTA",K5>1002,K5<5001),VLOOKUP(D5,ApprovalKey,3,FALSE),
IF(AND(D5="ATLANTA",K5>5002,K5<10001),VLOOKUP(D5,ApprovalKey,4,FALSE),
IF(AND(D5="ATLANTA",K5>10002),VLOOKUP(D5,ApprovalKey,5,FALSE),
IF(AND(D5="BEDFORD PARK",K5>1,K5<1001),VLOOKUP(D5,ApprovalKey,2,FALSE),
IF(AND(D5="BEDFORD PARK",K5>1002,K5<5001),VLOOKUP(D5,ApprovalKey,3,FALSE),
IF(AND(D5="BEDFORD PARK",K5>5002,K5<10001),VLOOKUP(D5,ApprovalKey,4,FALSE),
IF(AND(D5="BEDFORD PARK",K5>10002),VLOOKUP(D5,ApprovalKey,5,FALSE),"")))))))))))))

这是我尝试的数组:

    =ARRAYFORMULA(IF(AND(D2:D="SAN BERNARDINO",K2:K>1,K2:K<1001),VLOOKUP(D2:D,ApprovalKey,2,FALSE),IF(AND(D2:D="SAN BERNARDINO",K2:K>1002,K2:K<5001),VLOOKUP(D2:D,ApprovalKey,3,FALSE),
IF(AND(D2:D="SAN BERNARDINO",K2:K>5002,K2:K<10001),VLOOKUP(D2:D,ApprovalKey,4,FALSE),
IF(AND(D2:D="SAN BERNARDINO",K2:K>10002),VLOOKUP(D2:D,ApprovalKey,5,FALSE),
IF(AND(D2:D="ATLANTA",K2:K>1,K2:K<1001),VLOOKUP(D2:D,ApprovalKey,2,FALSE),
IF(AND(D2:D="ATLANTA",K2:K>1002,K2:K<5001),VLOOKUP(D2:D,ApprovalKey,3,FALSE),
IF(AND(D2:D="ATLANTA",K2:K>5002,K2:K<10001),VLOOKUP(D2:D,ApprovalKey,4,FALSE),
IF(AND(D2:D="ATLANTA",K2:K>10002),VLOOKUP(D2:D,ApprovalKey,5,FALSE),
IF(AND(D2:D="BEDFORD PARK",K2:K>1,K2:K<1001),VLOOKUP(D2:D,ApprovalKey,2,FALSE),
IF(AND(D2:D="BEDFORD PARK",K2:K>1002,K2:K<5001),VLOOKUP(D2:D,ApprovalKey,3,FALSE),
IF(AND(D2:D="BEDFORD PARK",K2:K>5002,K2:K<10001),VLOOKUP(D2:D,ApprovalKey,4,FALSE),
IF(AND(D2:D="BEDFORD PARK",K2:K>10002),VLOOKUP(D2:D,ApprovalKey,5,FALSE),"")))))))))))))

我只是不允许以这种方式使用arrayformula吗?

1 个答案:

答案 0 :(得分:0)

确定,尝试:

=ARRAYFORMULA(IFERROR(
 IF((D5:D="SAN BERNARDINO")*(K5:K>1)   *(K5:K<1001), VLOOKUP(D5:D,ApprovalKey,2,0),
 IF((D5:D="SAN BERNARDINO")*(K5:K>1002)*(K5:K<5001), VLOOKUP(D5:D,ApprovalKey,3,0),
 IF((D5:D="SAN BERNARDINO")*(K5:K>5002)*(K5:K<10001),VLOOKUP(D5:D,ApprovalKey,4,0),
 IF((D5:D="SAN BERNARDINO")*(K5:K>10002),            VLOOKUP(D5:D,ApprovalKey,5,0),
 IF((D5:D="ATLANTA")       *(K5:K>1)   *(K5:K<1001), VLOOKUP(D5:D,ApprovalKey,2,0),
 IF((D5:D="ATLANTA")       *(K5:K>1002)*(K5:K<5001), VLOOKUP(D5:D,ApprovalKey,3,0),
 IF((D5:D="ATLANTA")       *(K5:K>5002)*(K5:K<10001),VLOOKUP(D5:D,ApprovalKey,4,0),
 IF((D5:D="ATLANTA")       *(K5:K>10002),            VLOOKUP(D5:D,ApprovalKey,5,0),
 IF((D5:D="BEDFORD PARK")  *(K5:K>1)   *(K5:K<1001), VLOOKUP(D5:D,ApprovalKey,2,0),
 IF((D5:D="BEDFORD PARK")  *(K5:K>1002)*(K5:K<5001), VLOOKUP(D5:D,ApprovalKey,3,0),
 IF((D5:D="BEDFORD PARK")  *(K5:K>5002)*(K5:K<10001),VLOOKUP(D5:D,ApprovalKey,4,0),
 IF((D5:D="BEDFORD PARK")  *(K5:K>10002),            VLOOKUP(D5:D,ApprovalKey,5,0),
 ))))))))))))))

0