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

时间:2017-01-03 09:37:21

标签: excel function if-statement excel-2003 simplify

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

我想补充一下,但Excel告诉我我的功能太长了。

有人知道如何简化或缩短功能的长度吗?

Column K3中,我有一个缺陷类型的下拉列表,然后这个IF函数在L3列中,根据column K3中选择的缺陷类型显示特定的缺陷描述。

=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")

2 个答案:

答案 0 :(得分:1)

一种简单的方法是制作单独的列表并检查列表中是否存在K3。例如,在

的任何列(此处为J)中创建一个列表
  1. 异常整理
  2. 弯曲标记
  3. Bent
  4. 污染
  5. 使用此公式检查此列表中是否存在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是国内,维度和汇编标准的列表

    这可以进一步研究。

答案 1 :(得分:0)

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

粘贴到 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")