If, Then Statements

  • Thread starter Thread starter Guest
  • Start date Start date
By trying to undestand your prev post, try

If 5 or More, then 4
If 3 or 4, then 2
If 1 0r 2, then O

IIf([Charge] > 5 , 4 , IIf([Charge] In (3,4) , 2, 0))
 
Sorry, need to add =>

IIf([Charge] >= 5 , 4 , IIf([Charge] In (3,4) , 2, 0))

--
Good Luck
BS"D


Ofer Cohen said:
By trying to undestand your prev post, try

If 5 or More, then 4
If 3 or 4, then 2
If 1 0r 2, then O

IIf([Charge] > 5 , 4 , IIf([Charge] In (3,4) , 2, 0))

--
Good Luck
BS"D


Sharon Walls said:
What if [Charge] is a numeric field? Would the same apply
 
Will this still work if you are setting up an if, then statement where the
data your are pulling from is in a look-up column.
I tried using this same formula and it is coming up error but works when
just a text or numeric field.

Ofer Cohen said:
By trying to undestand your prev post, try

If 5 or More, then 4
If 3 or 4, then 2
If 1 0r 2, then O

IIf([Charge] > 5 , 4 , IIf([Charge] In (3,4) , 2, 0))

--
Good Luck
BS"D


Sharon Walls said:
What if [Charge] is a numeric field? Would the same apply
 
If you want to use it in a form, and display the right value depend on the
value selected in a combo box, you can create another text box in the form
and in the control source of it write

=IIf(Nz([ComboName],0) >= 5 , 4 , IIf(Nz([ComboName],0) In (3,4) , 2,
IIf(Nz([ComboName],0) In (1,2),0,Null)))

The Nz used to convert Null with 0, Null might return error.
This way no code is involved

--
Good Luck
BS"D


Sharon Walls said:
Will this still work if you are setting up an if, then statement where the
data your are pulling from is in a look-up column.
I tried using this same formula and it is coming up error but works when
just a text or numeric field.

Ofer Cohen said:
By trying to undestand your prev post, try

If 5 or More, then 4
If 3 or 4, then 2
If 1 0r 2, then O

IIf([Charge] > 5 , 4 , IIf([Charge] In (3,4) , 2, 0))

--
Good Luck
BS"D


Sharon Walls said:
What if [Charge] is a numeric field? Would the same apply
 
When you say [ComboName] what field do I use?
The field that is doing the look-up?

Ofer Cohen said:
If you want to use it in a form, and display the right value depend on the
value selected in a combo box, you can create another text box in the form
and in the control source of it write

=IIf(Nz([ComboName],0) >= 5 , 4 , IIf(Nz([ComboName],0) In (3,4) , 2,
IIf(Nz([ComboName],0) In (1,2),0,Null)))

The Nz used to convert Null with 0, Null might return error.
This way no code is involved

--
Good Luck
BS"D


Sharon Walls said:
Will this still work if you are setting up an if, then statement where the
data your are pulling from is in a look-up column.
I tried using this same formula and it is coming up error but works when
just a text or numeric field.

Ofer Cohen said:
By trying to undestand your prev post, try

If 5 or More, then 4
If 3 or 4, then 2
If 1 0r 2, then O

IIf([Charge] > 5 , 4 , IIf([Charge] In (3,4) , 2, 0))

--
Good Luck
BS"D


:

What if [Charge] is a numeric field? Would the same apply
 
Back
Top