Go Premium for a chance to win a PS4. Enter to Win

x
Solved

# IIF And

Posted on 2011-09-24
Medium Priority
376 Views
I know there is probably a simple answer to the below, but I can not get this to run correctly

DstNfin: IIf([DISTANCE]<([DSTFUR]+1.01 And [DISTANCE]>([DSTFUR]-1.01)),[RWNF],0)

What I want is if Distance is between Dstfur plus or minus 1.01 to return RWNF.  If not it would reutrn 0.    For example, DISTANCE is 8 and DSTFUR is 6, would return 0.  If DISTANCE was 8 and DSTFUR is 7, would return RWNF.
0
Question by:JackJackson54
• 3

LVL 61

Expert Comment

ID: 36592161
Try this:

DstNfin: IIf([Distance] BETWEEN [DSTFUR] - 1.01 AND [DSTFUR] + 1.01, [RWNF],0)

0

LVL 61

Accepted Solution

mbizup earned 2000 total points
ID: 36592165
Parentheses to make it clearer:

DstNfin: IIf([Distance] BETWEEN ([DSTFUR] - 1.01) AND ([DSTFUR] + 1.01), [RWNF],0)

0

Author Closing Comment

ID: 36592171
Thank you as that worked.  I tried between late last night and it did not work as I was doing something wrong
0

LVL 61

Expert Comment

ID: 36593165

One thing I have found helpful in getting the syntax of these logical statements is to get them out of my head and into writing (pseudocode), and working from there.

Your original post here came very close to speling out the correct syntax :)
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question