From: Marc on
I would like to combine two iif together. I am able to get the results from
a single iif statement but not successful in combining the two.

iif([cert master]!Verbiage Like "*Best Buy Gift Card*",0.008,[discount]/3*7)

iif ([cert master]!Verbiage Like "*Bath & Body Works*",0.005, [discount]/3*7)

I thought a comma would work, but it does not. If I try or it does not
calculate correctly.

Thank you
From: John W. Vinson on
On Fri, 2 Apr 2010 17:34:01 -0700, Marc <Marc(a)discussions.microsoft.com>
wrote:

>I would like to combine two iif together. I am able to get the results from
>a single iif statement but not successful in combining the two.
>
>iif([cert master]!Verbiage Like "*Best Buy Gift Card*",0.008,[discount]/3*7)
>
>iif ([cert master]!Verbiage Like "*Bath & Body Works*",0.005, [discount]/3*7)
>
>I thought a comma would work, but it does not. If I try or it does not
>calculate correctly.
>
>Thank you

So you want to use 3/7ths of the discount if the verbiage doesn't match either
option?

If so you need one IIF nested inside another, or, perhaps better, the builtin
Switch() function. The latter takes arguments in pairs, evaluates the pairs
left to right, and when it finds a true value in the first element returns the
second and quits. Try

Switch(([cert master]!Verbiage Like "*Best Buy Gift Card*" ,0.008,
[cert master]!Verbiage Like "*Bath & Body Works*",0.005,
True, [discount]/3*7)


You can also use nested IIF's but that can get hard to read and hard to
maintain.
--

John W. Vinson [MVP]
From: John W. Vinson on
On Fri, 02 Apr 2010 20:47:06 -0600, John W. Vinson
<jvinson(a)STOP_SPAM.WysardOfInfo.com> wrote:

>On Fri, 2 Apr 2010 17:34:01 -0700, Marc <Marc(a)discussions.microsoft.com>
>wrote:
>
>>I would like to combine two iif together. I am able to get the results from
>>a single iif statement but not successful in combining the two.
>>
>>iif([cert master]!Verbiage Like "*Best Buy Gift Card*",0.008,[discount]/3*7)
>>
>>iif ([cert master]!Verbiage Like "*Bath & Body Works*",0.005, [discount]/3*7)
>>
>>I thought a comma would work, but it does not. If I try or it does not
>>calculate correctly.
>>
>>Thank you
>
>So you want to use 3/7ths of the discount if the verbiage doesn't match either
>option?
>
>If so you need one IIF nested inside another, or, perhaps better, the builtin
>Switch() function. The latter takes arguments in pairs, evaluates the pairs
>left to right, and when it finds a true value in the first element returns the
>second and quits. Try
>
>Switch(([cert master]!Verbiage Like "*Best Buy Gift Card*" ,0.008,
>[cert master]!Verbiage Like "*Bath & Body Works*",0.005,
>True, [discount]/3*7)

Sorry - had an extra ( in there, should be

Switch([cert master]!Verbiage Like "*Best Buy Gift Card*" ,0.008,
[cert master]!Verbiage Like "*Bath & Body Works*",0.005,
True, [discount]/3*7)
--

John W. Vinson [MVP]