Print Page | Close Window

Nested Iff statement

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=4244
Printed Date: 02 May 2024 at 7:50am


Topic: Nested Iff statement
Posted By: mardiana
Subject: Nested Iff statement
Date Posted: 14 Sep 2008 at 9:27am

I'm having a hard time getting a nested IFF statement to work.  I have 6 variables for each record.  In a 7th cell, I'm trying to build a formula that will scan the 6 variables and determine if they contain 3 required values and report 'OK' if so, or 'Problem' if not.  Summing 'successes' needs to be >= 3. 

Example:  The values required for 'OK' are 20, 30, 40.  If all three values are not found, there is a problem.
 
Var 1   Var2   Var3   Var4   Var5   Var6   Result
  10      20       25      30      35       40     OK
  10      15       20      30      35       38      Problem
 
Any assistance you could provide would be appreciated!  Tongue



Replies:
Posted By: Savan
Date Posted: 14 Sep 2008 at 10:15pm

you can write the IFF statement as below.

if mailto:%7b@var1 - {var1 } = 20 or mailto:%7b@var2 - {var2 } = 20 or mailto:%7b@var3 - {var3 } = 20 or mailto:%7b@var4 - {var4 } = 20 or mailto:%7b@var5 - {var5 } = 20 or mailto:%7b@var6 - {var6 } = 20 then
   (
     if mailto:%7b@var1 - {var1 } = 30 or mailto:%7b@var2 - {var2 } = 30 or mailto:%7b@var3 - {var3 } = 30 or mailto:%7b@var4 - {var4 } = 30 or mailto:%7b@var5 - {var5 } = 30 or mailto:%7b@var6 - {var6 } = 30 then
         (
             if mailto:%7b@var1 - {var1 } = 40 or mailto:%7b@var2 - {var2 } = 40 or mailto:%7b@var3 - {var3 } = 40 or mailto:%7b@var4 - {var4 } = 40 or mailto:%7b@var5 - {var5 } = 40 or mailto:%7b@var6 - {var6 } = 40 then
                ("OK")
            else
                ("PROBLEM";)
   
         )
    else
         ("PROBLEM";)
   )
else
   ("PROBLEM";)


-------------
Thanks
Savan



Print Page | Close Window