IF 的参数数量错误

Wrong number of arguments to IF

使用下面的公式,我一直收到错误 "Wrong number of arguments to IF. Expected between 2 and 3 arguments, but received 5 arguments."

我哪里做错了?它一直运行到某个点,然后代码抛出上述错误...我是否在某处缺少逗号或括号?

非常感谢任何帮助:)

=arrayformula(If(G5 <> "",if(H5 = "Y",if(C6 = "Sub-Total", ttime($M,vlookup(B5,Lookup!$A:$I,3,0)),if(AND(C7 = "Sub-Total",B6 <>"",B5 <>""),ttime($M,vlookup(B6,Lookup!$A:$I,3,0),vlookup(B5,Lookup!$A:$I,3,0)),if(AND(C8 = "Sub-Total",B7 <> "", B6 <> "",B5 <>""),ttime($M,vlookup(B7,Lookup!$A:$I,3,0),vlookup(B6,Lookup!$A:$I,3,0),vlookup(B5,Lookup!$A:$I,3,0)),if(AND(C9 = "Sub-Total",B8 <> "", B7 <> "",B6 <>"",B5 <> ""),ttime($M,vlookup(B8,Lookup!$A:$I,3,0),vlookup(B7,Lookup!$A:$I,3,0),vlookup(B6,Lookup!$A:$I,3,0)),vlookup(B5,Lookup!$A:$I,3,0)),if(AND(C10 = "Sub-Total",B9 <> "", B8 <> "",B7 <>"",B6 <> "",B5 <> ""),ttime($M,vlookup(B9,Lookup!$A:$I,3,0),vlookup(B8,Lookup!$A:$I,3,0),vlookup(B7,Lookup!$A:$I,3,0)),vlookup(B6,Lookup!$A:$I,3,0)),vlookup(B5,Lookup!$A:$I,3,0))))+IF(C6 = "sub-total","",if(B5 <> "", G6 * 3,""))+IF(C6 = "sub-total","",if(B5 <> "", "15","")),"Not Despatched"),""))

尝试:

=ARRAYFORMULA(
 IF(G5<>"", 
 IF(H5="Y",
 IF(C6="Sub-Total",                                               TTIME($M, VLOOKUP(B5, Lookup!$A:$I, 3, 0)),
 IF(AND(C7="Sub-Total", B6<>"", B5<>""),                          TTIME($M, VLOOKUP(B6, Lookup!$A:$I, 3, 0), 
                                                                              VLOOKUP(B5, Lookup!$A:$I, 3, 0)), 
 IF(AND(C8="Sub-Total", B7<>"", B6<>"", B5<>""),                  TTIME($M, VLOOKUP(B7, Lookup!$A:$I, 3, 0), 
                                                                              VLOOKUP(B6, Lookup!$A:$I, 3, 0), 
                                                                              VLOOKUP(B5, Lookup!$A:$I, 3, 0)),
 IF(AND(C9="Sub-Total", B8<>"", B7<>"", B6<>"", B5<>""),          TTIME($M, VLOOKUP(B8, Lookup!$A:$I, 3, 0), 
                                                                              VLOOKUP(B7, Lookup!$A:$I, 3, 0),
                                                                              VLOOKUP(B6, Lookup!$A:$I, 3, 0),
                                                                              VLOOKUP(B5, Lookup!$A:$I, 3, 0)),
 IF(AND(C10="Sub-Total", B9<>"", B8<>"", B7<>"", B6<>"", B5<>""), TTIME($M, VLOOKUP(B9, Lookup!$A:$I, 3, 0),
                                                                              VLOOKUP(B8, Lookup!$A:$I, 3, 0), 
                                                                              VLOOKUP(B7, Lookup!$A:$I, 3, 0),
                                                                              VLOOKUP(B6, Lookup!$A:$I, 3, 0),
                                                                              VLOOKUP(B5, Lookup!$A:$I, 3, 0)))))))+
 IF(C6="sub-total",,
 IF(B5<>"", G6*3, ))+
 IF(C6="sub-total",,
 IF(B5<>"", "15", )), "Not Despatched"), ))