# IIF Function based on a Value and a Calculation

I have two fields; One that has a static number from a linked report and the other which I created based on Calculations from two other fields.

I created a IIF Statement:  Odd Match: IIf([Speed 1]=[Speed 2],1,0)

Speed 1 is the static number and Speed 2 is the calculated field based off of two other fields.

They are all set as numbers, yet they are not agreeing.

Do you have any suggestions of what I should look for?

Feeling a little dumb right now...
###### Who is Participating?

Commented:
Depends on your calculations and the datatypes of the static number and the computed value.  If they are double or single precision numbers, there could be some rounding error in the computed value.  If that is the case, you might want to try:

Odd Match: IIF(Abs([Speed 1] - [Speed 2]) < .01, 1, 0)

This would check to see if the values are within 0.01 of each other.  Rounding error generally occur deep below the decimal point, so you might want to replace .01 with .0000001 or something like that.
0

Commented:
this is just a test to see if your expression works

Odd Match: IIf(Int([Speed 1])=Int([Speed 2]),1,0)
0

Author Commented:
Hi Cap,
Sorry, the integer did not work. :-(

Hi Fryed,
Fantastic!  Thank you so much.

Thank you both for the prompt reponses.

Have a marvelous day!
0

Commented:
That's "fyed", not "Fryed".  LOL

0

Author Commented:
LOL  Sorry.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.