PDA

View Full Version : Easier To Read IF Statements



Gareth Horton
July 12th, 2002, 02:47 PM
The Monarch Tip in the Spring 2002 Issue of the Monarch Newsletter, the author
uses the following nested IF() statements to translate a Product Line Letter
to it's description:

IF([Product Line Letter]=”A”,”Heavy Equipment”, IF([Product Line Letter]=”B”,”Light
Equipment”, IF([Product Line Letter]=”C”,”Shop Floor Machinery”, “Other”)))

With simple lists like this, if you don't have a "default" value, the formula
can be entered as such:

IF([Product Line Letter] = "A", "Heavy Equipment", "") +
IF([Product Line Letter] = "B", "Light Equipment", "") +
IF([Product Line Letter] = "C", "Shop Floor Machinery", "")

If you do have a "default" value, the formula is:

IF([Product Line Letter] = "A", "Heavy Equipment", "") +
IF([Product Line Letter] = "B", "Light Equipment", "") +
IF([Product Line Letter] = "C", "Shop Floor Machinery", "")+
IF([Product Line Letter].NotIn.("A","B","C"), "Other", "")

One last note, this can be reduced even further to no IF() statements by making
a LookUp table for the letters A, B, & C and a default of Other for no matches (as stated
in the article).

Just My $0.02.

Hope this helps your formulas!