IF中的函数太长。 如何简化?

我已经在Excel 2003工作表的单元格中编写了一个长的If函数。

我想补充一点,但是,Excel告诉我,我的function太长了。

有人知道如何简化或减less函数的长度?

Column K3 ,我有一个缺陷types的下拉列表,然后这个中间函数在列L3中出现一个特定的缺陷描述,这个缺陷描述是根据column K3select的缺陷types。

 =IF(ISTEXT(K3)=TRUE,IF(OR(K3="Abnormal Finishing",K3="Bending Mark",K3="Bent",K3="Contamination",K3="Crack",K3="Damage",K3="Dented",K3="Discoloration",K3="Finger Print",K3="Flow Mark",K3="Gap",K3="Insufficient Paint",K3="Scratches",K3="Rusty",K3="Stain Mark",K3="Standoff Mark",K3="Tool Mark",K3="Warpage",K3="Water Mark",K3="White Mark",K3="White Spot"),"Cosmetic",IF(OR(K3="Angle Out",K3="Dimension Out",K3="Fitting Problem"),"Dimension",IF(OR(K3="Assembly Misalignment",K3="Fan Broken",K3="Fan Not Functioning",K3="Assembly Wrong Orientation",K3="Missing Component",K3="Missing Rivet (Assembly)",K3="Part Warping (Assembly)",K3="Rivet Loose (Drop) (Assembly)",K3="Rivet Wrong Location (Assembly)",K3="Rivet Wrong Orientation (Assembly)",K3="Screw Loose (Drop)",K3="Screw Stuck"),"Assembly","ERROR"))),"ERROR") 

一个简单的方法是制作单独的列表,并检查列表中是否存在K3 。 例如在任何一列(J这里)列出一个列表

  1. exception完成
  2. 弯曲的标记
  3. 弯曲
  4. 污染

使用此公式来检查您的K3中的值是否存在于此列表中

=IFERROR(MATCH(K3,J11:J14,0)>0,FALSE)

J11:J14是我的清单。 公式结果为TRUEFALSE

你的最终公式看起来像

 =IF(ISTEXT(K3),IF(IFERROR(MATCH(K3,L3:L7,0)>0,FALSE),"Cosmetic",IF(IFERROR(MATCH(K3,M3:M7,0)>0,FALSE),"Dimension",IF(IFERROR(MATCH(K3,N3:N7,0)>0,FALSE),"Assembly","ERROR"))),"ERROR") 

哪里

L3:L7M3:M7N3:N7是国内,维度和组装标准的列表

这可以进一步处理。

我通常发现使用VLOOKUP函数可以避免多个IF语句。 你需要你的条件和结果在这样的表格中:

粘贴到A4:A39

 Abnormal Finishing Bending Mark Bent Contamination Crack Damage Dented Discoloration Finger Print Flow Mark Gap Insufficient Paint Scratches Rusty Stain Mark Standoff Mark Tool Mark Warpage Water Mark White Mark White Spot Angle Out Dimension Out Fitting Problem Assembly Misalignment Fan Broken Fan Not Functioning Assembly Wrong Orientation Missing Component Missing Rivet (Assembly) Part Warping (Assembly) Rivet Loose (Drop) (Assembly) Rivet Wrong Location (Assembly) Rivet Wrong Orientation (Assembly) Screw Loose (Drop) Screw Stuck 

粘贴到B4:B39

 Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Cosmetic Dimension Dimension Dimension Assembly Assembly Assembly Assembly Assembly Assembly Assembly Assembly Assembly Assembly Assembly Assembly 

那么你可以使用下面的公式:

 =IFERROR(VLOOKUP(K3,$A$4:$B$39,2,0),"ERROR")