If Statement not working

  • Thread starter Thread starter Heather
  • Start date Start date
H

Heather

My if statement does not work The last part of the
expression does pull. Can anyone see why? THANKS..


avgtotal1: IIf([emp_name]="Mary Smith",([total]/((4/52)
*45)),IIf([emp_name]="Brian B" Or "Daniel Ch",([total]/
((8/52)*45)),([total]/((13/52)*45))))
 
My if statement does not work The last part of the
expression does pull. Can anyone see why? THANKS..

avgtotal1: IIf([emp_name]="Mary Smith",([total]/((4/52)
*45)),IIf([emp_name]="Brian B" Or "Daniel Ch",([total]/
((8/52)*45)),([total]/((13/52)*45))))

In math operational order, it makes no difference (when multiplying or
dividing) which are done first, so you don't need all those
parenthesis groupings. When Addition or Subtraction is involved, then
you do need to group the order of processing with parenthesis.

Other than un-needed parenthesis in the first IIf statement, I didn't
see anything wrong.

In the second IIf statement, you must repeat the criteria field for
each "AND" or "OR" part.

avgtotal1: IIf([emp_name]="Mary Smith",[total]/4/52*45,
IIf([emp_name]="Brian B" Or [emp_Name] = "Daniel Ch",[total]/
8/52*45,[total]/13/52*45))
 
Back
Top