无法添加if语句超过允许的嵌套级别?

时间:2014-09-23 09:32:30

标签: excel if-statement excel-formula

我的公式中有5个if语句的列表,我想要添加第6个,但它不会让我说我已经超过允许的嵌套级别。 有人可以告诉我如何在代码中添加以下内容吗?

IF(COUNT(SEARCH({"BTF","BTH","BTO","BTP"},G18)),HYPERLINK("\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&_Audits\assets\EMAIL_2.msg"),"")

代码:

=IF(COUNT(SEARCH({"XWS","XWW","XWO","XVV","XVS","XVO","XVH","XTO","XTA","XSW","XSV","XST","XSS","XSS","XSR","XSP","XSL","XSJ","XSH","XSG","XSF","XSE","XSD","XSC","XSB","XSA","XS5","XS2","XPO","XMO","XMF","XLS","XLP","XLO","XLL","XLB","XKT","XKR","XKO","XKH","XKE","XKD","XJS","XHO","XHL","XHF","XHA","XGO","XFT","XFO","XFC","XFA","XDO","XBS","XBO","XAO","WHO","PSO","PRO","PRM","PRE","PPT","PLO","PGW","PGV","PGT","PGS","PGR","PGP","PGH","PGF","PGE","PGB","PGA","PFP","PDC","PDB","PCP","PBO","OFD","MWW","MWC","MTT","MSP","MSO","MRM","MPP","MPO","MPF","MNO","MMW","MMS","MMP","MMI","MLO","MJO","MHH","MGO","MFO","MEE","MEB","MDO","MCO","MAT"},G18)),HYPERLINK("\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&_Audits\assets\EMAIL_PLANT2.msg"),
 IF(COUNT(SEARCH({"XCT","XCO","XCA"},G18)),HYPERLINK("\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&_Audits\assets\EMAIL_CRANE2.msg"),
 IF(COUNT(SEARCH({"XJO","XJS"},G18)),HYPERLINK("\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&_Audits\assets\EMAIL_OPERATOR2.msg"),
 IF(COUNT(SEARCH({"LTV","LTH","LSW","LMC"},G18)),HYPERLINK("\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&_Audits\assets\EMAIL_3PL2.msg"),
 IF(COUNT(SEARCH({"UUU","KKK","PPP","ACO","ARC","BCO","BCP","BFA","BFI","BFL","BFP","BHO","BPO","BSO","BTF","BTH","BTO","BTP","CMA","CME","CMF","CMH","CML","CMN","CMP","CMZ","DHA","EAA","EAP","ECC","ECC","ECE","EPM","EPO","FPA","FPB","FPC","FPD","FPE","FPF","FPH","FPI","FPJ","FPL","FPM","FPN","FPO","FPP","FPR","FPS","FPV","FPW","FSC","FUE","FUG","FUW","FWC","FWG","FWH","HPO","ICH","ICM","ICN","ICS","ITL","ITM","QMO","RSS","RTT","SFG","SLB","SLC","SLR","SLT","SMA","SMC","SMM","SMP","SMR","SSF","SSG","SSV","STA","STO","UEO","UGO","UWO","ZFO"},G18)),HYPERLINK("\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&_Audits\assets\EMAIL_2.msg"),  IF(COUNT(SEARCH({"BRL","BRP","BRS"},G18)),HYPERLINK("\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&_Audits\assets\EMAIL_RECRUITMENT2.msg"),
 ""))))))

1 个答案:

答案 0 :(得分:0)

我同意@Rowland Shaw关于一个单独的查找表。

但是如果你设置了很多IF()而不是只返回一个空白作为每个的错误结果,并连接所有结果。

=
HYPERLINK("\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&_Audits\assets\"
&
 IF(COUNT(SEARCH({"XWS","XWW","XWO","XVV","XVS","XVO","XVH","XTO","XTA","XSW","XSV","XST","XSS","XSS","XSR","XSP","XSL","XSJ","XSH","XSG","XSF","XSE","XSD","XSC","XSB","XSA","XS5","XS2","XPO","XMO","XMF","XLS","XLP","XLO","XLL","XLB","XKT","XKR","XKO","XKH","XKE","XKD","XJS","XHO","XHL","XHF","XHA","XGO","XFT","XFO","XFC","XFA","XDO","XBS","XBO","XAO","WHO","PSO","PRO","PRM","PRE","PPT","PLO","PGW","PGV","PGT","PGS","PGR","PGP","PGH","PGF","PGE","PGB","PGA","PFP","PDC","PDB","PCP","PBO","OFD","MWW","MWC","MTT","MSP","MSO","MRM","MPP","MPO","MPF","MNO","MMW","MMS","MMP","MMI","MLO","MJO","MHH","MGO","MFO","MEE","MEB","MDO","MCO","MAT"},G18)),"EMAIL_PLANT2.msg","") 
&
 IF(COUNT(SEARCH({"XCT","XCO","XCA"},G18)),"EMAIL_CRANE2.msg","")
&
 IF(COUNT(SEARCH({"XJO","XJS"},G18)),"EMAIL_OPERATOR2.msg","")
&
 IF(COUNT(SEARCH({"LTV","LTH","LSW","LMC"},G18)),"EMAIL_3PL2.msg","")
&
 IF(COUNT(SEARCH({"UUU","KKK","PPP","ACO","ARC","BCO","BCP","BFA","BFI","BFL","BFP","BHO","BPO","BSO","BTF","BTH","BTO","BTP","CMA","CME","CMF","CMH","CML","CMN","CMP","CMZ","DHA","EAA","EAP","ECC","ECC","ECE","EPM","EPO","FPA","FPB","FPC","FPD","FPE","FPF","FPH","FPI","FPJ","FPL","FPM","FPN","FPO","FPP","FPR","FPS","FPV","FPW","FSC","FUE","FUG","FUW","FWC","FWG","FWH","HPO","ICH","ICM","ICN","ICS","ITL","ITM","QMO","RSS","RTT","SFG","SLB","SLC","SLR","SLT","SMA","SMC","SMM","SMP","SMR","SSF","SSG","SSV","STA","STO","UEO","UGO","UWO","ZFO"},G18)),"EMAIL_2.msg","")
&
 IF(COUNT(SEARCH({"BRL","BRP","BRS"},G18)),"EMAIL_RECRUITMENT2.msg","")
)