2017-01-03 45 views
1

我在Excel 2003工作表中的單元格中寫了一個long If函數。在Excel中的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") 

回答

1

一個簡單的方法是使單獨的列表,並檢查是否存在在列表中K3。例如做一個列表中的任何列(j這裏)爲

  1. 異常整理
  2. 彎曲馬克
  3. 污染

使用這個公式來檢查,如果你在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是國內,尺寸和裝配標準清單

這可能是進一步工作。

+0

而且一個這個解決方案的優點是可以很容易地將項目添加到每個列表。 –

+0

如果你正在做列表,你也可以在'Column J'的缺點和'Column K'類型上做一些事情。所以一個簡單的帶有VLOOKUP的'IFERROR()'也可以很容易地添加項目,它會縮短公式甚至更多 – Moacir

0

我通常發現使用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")