How to work on multiple IIF

K

Kutty

How to work on multiple IIF condition.
Probably an example : iif([a]>,([a]-),iif(>[a],(-[a])
Can I do like this? is there any other way?
Please provide more multiple function of iif.
Please let me know what is the difference of if and iif.
 
W

Wayne Morgan

Using your example, it should look like:

iif([a]>,[a]-,iif(>[a],-[a]))

Of course in the example above, if neither is true, then a = b and the
subtraction will yield 0.

iif([a]>,[a]-,iif(>[a],-[a],0))

Also, in case this is what you're really trying to do and it's not just an
example, in this case it would be easier to use Abs().

Abs([a] - )
 
K

Kutty

Thanks a lot for your Great! help. I make use of it. I did not understand
how is working Abs([a] - ). Could you please explain about this briefly?
Thanks in advance.
-----------------------------------------------------------------------------------------


Wayne Morgan said:
Using your example, it should look like:

iif([a]>,[a]-,iif(>[a],-[a]))

Of course in the example above, if neither is true, then a = b and the
subtraction will yield 0.

iif([a]>,[a]-,iif(>[a],-[a],0))

Also, in case this is what you're really trying to do and it's not just an
example, in this case it would be easier to use Abs().

Abs([a] - )

--
Wayne Morgan
MS Access MVP


Kutty said:
How to work on multiple IIF condition.
Probably an example : iif([a]>,([a]-),iif(>[a],(-[a])
Can I do like this? is there any other way?
Please provide more multiple function of iif.
Please let me know what is the difference of if and iif.

 
W

Wayne Morgan

The Abs([a] - ) only refers to the specific example you gave, not to IIf
in general. In the specific example you gave, subtacting a smaller value
from a larger value, the Abs() function will accomplish the same thing.
Using IIf, you're arranging the order of the values in the equation to
always subtract the smaller value from the larger. This will give a positive
value or zero. You could use Abs() to do this also, without rearanging the
values.

Example:
3 - 2 = 1
2 - 3 = -1
Abs(3 - 2) = 1
Abs(2 - 3) = 1

-2 - (-3) = 1
-3 - (-2) = -1
Abs(-2 - (-3)) = 1
Abs(-3 - (-2)) = 1

--
Wayne Morgan
MS Access MVP


Kutty said:
Thanks a lot for your Great! help. I make use of it. I did not
understand
how is working Abs([a] - ). Could you please explain about this
briefly?
Thanks in advance.
-----------------------------------------------------------------------------------------


Wayne Morgan said:
Using your example, it should look like:

iif([a]>,[a]-,iif(>[a],-[a]))

Of course in the example above, if neither is true, then a = b and the
subtraction will yield 0.

iif([a]>,[a]-,iif(>[a],-[a],0))

Also, in case this is what you're really trying to do and it's not just
an
example, in this case it would be easier to use Abs().

Abs([a] - )

--
Wayne Morgan
MS Access MVP


Kutty said:
How to work on multiple IIF condition.
Probably an example : iif([a]>,([a]-),iif(>[a],(-[a])
Can I do like this? is there any other way?
Please provide more multiple function of iif.
Please let me know what is the difference of if and iif.

 
Top