Google表格将if语句转换为arrayformula

时间:2020-10-28 13:57:45

标签: google-sheets

如何将以下内容转换为可根据所有BA列和N列向下拖动的数组公式?

= IFS( ISBLANK($AD$2), IFS(N3="April 2020",(BA3/60)*$AD$3, N3="May 2020",(BA3/60)*$AD$4, N3="June 2020",(BA3/60)*$AD$5, N3="July 2020",(BA3/60)*$AD$6, N3="August 2020",(BA3/60)*$AD$7, N3="September 2020",(BA3/60)*$AD$8,N3="October 2020",(BA3/60)*$AD$9,N3="November 2020",(BA3/60)*$AD$10,N3="December 2020",(BA3/60)*$AD$11), NOT (ISBLANK($AD$2)), (BA3/60)*$AD$2)

https://docs.google.com/spreadsheets/d/1Z6d8SbFc5iO07pYgiudI9CR84PrwUWc5Q5wQpWKLWFc/edit#gid=0这是单元格F2中的公式

1 个答案:

答案 0 :(得分:0)

这对您有用吗?

= ArrayFormula(IF( ISBLANK($AE$2), 
    IF(O2:O="April 2020",                            (AJ2:AJ/60)*$AE$3, 
       IF(O2:O="May 2020",                           (AJ2:AJ/60)*$AE$4, 
          IF(O2:O="June 2020",                       (AJ2:AJ/60)*$AE$5, 
             IF(O2:O="July 2020",                    (AJ2:AJ/60)*$AE$6, 
                IF(O2:O="August 2020",               (AJ2:AJ/60)*$AE$7, 
                   IF(O2:O="September 2020",         (AJ2:AJ/60)*$AE$8,
                      IF(O2:O="October 2020",        (AJ2:AJ/60)*$AE$9,
                         IF(O2:O="November 2020",    (AJ2:AJ/60)*$AE$10,
                            IF(O2:O="December 2020", (AJ2:AJ/60)*$AE$11))))))))),
    (AJ2:AJ/60)*$AE$2))

让我们知道这是否满足您的要求...

公式在下面显示的添加列的G2中。

enter image description here

更新: 由于我已插入一列,以证明该公式给出的答案与F列中的公式完全相同,因此范围是偏移的。 这是针对F2中的放置位置更正的相同公式。

= ArrayFormula(IF( ISBLANK($AD$2), 
    IF(N2:N="April 2020",                            (AI2:AI/60)*$AD$3, 
       IF(N2:N="May 2020",                           (AI2:AI/60)*$AD$4, 
          IF(N2:N="June 2020",                       (AI2:AI/60)*$AD$5, 
             IF(N2:N="July 2020",                    (AI2:AI/60)*$AD$6, 
                IF(N2:N="August 2020",               (AI2:AI/60)*$AD$7, 
                   IF(N2:N="September 2020",         (AI2:AI/60)*$AD$8,
                      IF(N2:N="October 2020",        (AI2:AI/60)*$AD$9,
                         IF(N2:N="November 2020",    (AI2:AI/60)*$AD$10,
                            IF(N2:N="December 2020", (AI2:AI/60)*$AD$11))))))))),
    (AI2:AI/60)*$AD$2))

UPDATE#2:

我已将一个标签添加到工作表Calendar-GK。 F1单元格具有最终公式,其中包括标题标题,现在如下所示:

={"Money";ArrayFormula(IF( ISBLANK($AD$2), 
    IF(N2:N="April 2020",                            (AI2:AI/60)*$AD$3, 
       IF(N2:N="May 2020",                           (AI2:AI/60)*$AD$4, 
          IF(N2:N="June 2020",                       (AI2:AI/60)*$AD$5, 
             IF(N2:N="July 2020",                    (AI2:AI/60)*$AD$6, 
                IF(N2:N="August 2020",               (AI2:AI/60)*$AD$7, 
                   IF(N2:N="September 2020",         (AI2:AI/60)*$AD$8,
                      IF(N2:N="October 2020",        (AI2:AI/60)*$AD$9,
                         IF(N2:N="November 2020",    (AI2:AI/60)*$AD$10,
                            IF(N2:N="December 2020", (AI2:AI/60)*$AD$11))))))))),
    (AI2:AI/60)*$AD$2))}

enter image description here