简体   繁体   English

为什么我会收到错误 - 这个公式的参数太多了?

[英]Why am I getting the error - Too many arguments from this formula?

I am trying to create a macro for the following formula. 我正在尝试为以下公式创建一个宏。 First though, I need to get the formula working when referencing a spreadsheet saved separately on the hard drive. 首先,我需要在引用单独保存在硬盘驱动器上的电子表格时使公式正常工作。 Below is what I have but I am getting the error of Too many arguments . 以下是我所拥有的,但我得到了太多参数的错误。

=IFERROR(IF(C2<>"",IF(AND(VLOOKUP(A2&"",[LPSMatch.xlsx]Sheet1!$A:$B,2,FALSE)="Assigned Attorney",OR(B2="Jimmy Edwards",B2="Kathleen McCarthy")),"Sales Team",IF(AND(VLOOKUP(A2&"",[LPSMatch.xlsx]Sheet1!$A:$B,2,FALSE)="Intake Team, Assigned Attorney, or Sales Team",B2<>"Jimmy Edwards",B2<>"Kathleen McCarthy"),B2,IF(AND(VLOOKUP(A2&"",[LPSMatch.xlsx]Sheet1!$A:$B,2,FALSE)="Intake Team, Assigned Attorney, or Sales Team",OR(B2="Jimmy Edwards",B2="Kathleen McCarthy")),"Sales Team",IF(VLOOKUP(A2&"",[LPSMatch.xlsx]Sheet1!$A:$B,2,FALSE)="Assigned Attorney",B2,IF(AND(VLOOKUP(A2&"",[LPSMatch.xlsx]Sheet1!$A:$B,2,FALSE)="Sales Team",OR(B2="Jimmy Edwards",B2="Kathleen McCarthy")),"Sales Team",IF(C2<>"",VLOOKUP(A2&"",[LPSMatch.xlsx]Sheet1!$A:$B,2,FALSE),"INTAKE TEAM")))))), VLOOKUP(A2&"",[LPSMatch.xlsx]Sheet1!$A:$B,2,FALSE),"")

Any help? 有帮助吗? When I go to the function help all of the arguments are okay but it highlights the "" at the end of my formula. 当我转到函数帮助时,所有的参数都没问题,但它突出了我公式末尾的“”。

fwiw, you can use Alt + Enter to add line feeds to your long formula and add a little legibility. fwiw,您可以使用Alt + Enter为您的长公式添加换行符并添加一点易读性。 The line feeds and 'white-space' do not negatively impact the formula's performance in any way. 换行和“白色空间”不会以任何方式对公式的性能产生负面影响。

非常长的配方

All I had to do to get it working in its current state was at a ) to ... ,FALSE)), "") at the tail end. 我必须做的就是让它在当前状态下工作在a )... ,FALSE)), "")在尾端。

There is some repeated logic that could be paired up. 有一些重复的逻辑可以配对。 Line 2 could be OR paired with line 6 and 9 and line 11 seems completely redundant as you are still following the TRUE path for the first IF(C2<>"",... and the 'nothing matches' default appears to be doubled up. Here is my best shot. 第2行可以与第6行和第9行进行OR配对,第11行看起来完全是冗余的,因为你仍然遵循第一个IF(C2<>"",...的TRUE路径IF(C2<>"",...并且“无匹配”默认值似乎加倍这是我最好的一击。

=IFERROR(IF(C2<>"",
         IF(AND(
                OR(VLOOKUP(A2&"",[LPSMatch.xlsx]Sheet1!$A:$B, 2, FALSE)={"Assigned Attorney","Sales Team","Intake Team, Assigned Attorney, or Sales Team"}),
                OR(B2={"Jimmy Edwards","Kathleen McCarthy"})), "Sales Team",
         IF(AND(VLOOKUP(A2&"",[LPSMatch.xlsx]Sheet1!$A:$B,2,FALSE)="Intake Team, Assigned Attorney, or Sales Team",
                OR(B2<>{"Jimmy Edwards","Kathleen McCarthy"})), B2,
         IF(VLOOKUP(A2&"",[LPSMatch.xlsx]Sheet1!$A:$B,2,FALSE)="Assigned Attorney", B2,
             VLOOKUP(A2&"",[LPSMatch.xlsx]Sheet1!$A:$B,2,FALSE)))), "INTAKE TEAM"), "")

An OR function (or AND function ) can compare to an array of constants; OR函数 (或AND函数 )可以与常量数组进行比较; eg =if(or("BCD" = {"abc", "bcd", "cde"}), ... would be TRUE. Using this method reduces the VLOOKUP functions significantly. 例如=if(or("BCD" = {"abc", "bcd", "cde"}), ...将为TRUE。使用此方法可显着减少VLOOKUP函数

Footnote: the formula you are using is for an external workbook that is open. 脚注:您使用的公式是用于打开的外部工作簿。 You would need full path(s) to the workbook if it is closed. 如果关闭,您将需要工作簿的完整路径。 If you get the formula working, close the external workbook and all of the full path(s) will be added. 如果您使公式正常工作,请关闭外部工作簿,并添加所有完整路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM