function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CRMsimpleCRMsimple 

IF(AND(ISPICKVAL - HELP!!!

I'm having some difficulty updating the following formula field:


Code:
IF (Days_since_last_review__c   >=  120,"120 Days No Review",
  IF (Days_since_last_review__c   >=  90, "90 Days No Review", 
   IF (Days_since_last_review__c  = 0, "Never Had Review", null)
   )
  )
)

 I am trying to make the IF statements run but only if the picklist field Contact_Status__c is "Client" if not I want to the field to be null

Code:
IF(AND(ISPICKVAL( Contact_Status__c , "Client",
(Days_since_last_review__c   >= 120, "120 Days No Review",
(Days_since_last_review__c   >=  90, "90 Days No Review", 
(Days_since_last_review__c  = 0, "Never Had Review", null
   )
   )
)

 I am getting all sorts of save errors on this one (and any others that I've tried) - Can anyone put me on track?

Thanks
Jeremy


NPMNPM
I have not tested this, but I think it should work.  Assuming Contract status = Client is True, the next IF should be evaluated, if that also evaluates to True the field should be set to 120 Days No Review,  but if that evaluates to False, then the next IF should be evaluated (90) and follow through to (0). If Contract Status = Client is True andn all the subsequeent IF statement lines are all False the field should be set to Null.   IF Contract Status evaluates to False it should not evaluate the other IF lines and set the field to Null 




IF(

   ISPICKVAL( Contact_Status__c , "Client"),

      IF(Days_since_last_review__c   >= 120, "120 Days No Review",

         IF(Days_since_last_review__c   >=  90, "90 Days No Review",

            IF(Days_since_last_review__c  = 0, "Never Had Review",

   Null

                             )

                        )

                   )

        )


CRMsimpleCRMsimple
I'm getting the error message:  Incorrect number of parameters for function IF(). Expected 3, received 2.


:smileysad:
NPMNPM

and Rather than Null you might want to try using ""





IF(

   ISPICKVAL( Contact_Status__c , "Client"),

      IF(Days_since_last_review__c   >= 120, "120 Days No Review",

         IF(Days_since_last_review__c   >=  90, "90 Days No Review",

            IF(Days_since_last_review__c  = 0, "Never Had Review",

   ""

                             )

                        )

                   )

        )


CRMsimpleCRMsimple
...I wonder if I need OR in there.
NPMNPM

maybe 2 nulls?

 

"",""

CRMsimpleCRMsimple
nope - still getting the same error
NPMNPM

I'm Probably grasping at straws now:

  (ISPICKVAL( Contact_Status__c , "Client")),

 

The error message seems to indicate it is not finding a result for both a true and a false condition for each IF.

Hopefully BioscienceMan will get a look at this, he always seems to have the best take on these.

 

NPMNPM
One more suggestion to try:
 
 





IF(
   AND (ISPICKVAL( Contact_Status__c , "Client"), Days_since_last_review__c   >= 120), "120 Days No Review",
   IF(
      AND (ISPICKVAL( Contact_Status__c , "Client"), Days_since_last_review__c   >= 90), "90 Days No Review",
      IF(
        AND (ISPICKVAL( Contact_Status__c , "Client"), Days_since_last_review__c   = 0), "Never Had Review",
   null)))

CRMsimpleCRMsimple
That did it  -Thanks so much!!!

Really appreciate it.

Jeremy
NPMNPM
Seems so simple now :smileyvery-happy:
Kent ManningKent Manning
Looks like you fingured out the problem.  Sorry I didn't see the post earlier.

The IF statements require a value-if-true and a value-if-false in order to work.  Salesforce doesn't allow you to leave out one of the conditions, they all have to be there.  It would be nice if they would allow you to leave out the value-if-false and it would default to null like one is allowed to do in Excel.