How can I resolve the issue when using ISPICKVAL in formula?

368    Asked by Aashishchaursiya in Salesforce , Asked on Apr 18, 2023

 I have read the documentation and I am aware that picklist values need to use ISPICKVAL in the formula


I want this formula to show that If the status is 'A' or 'B' it will show the days (in numbers) for the first date if it isn't any of those statuses it will show the second.


IF(ISPICKVAL(Status, "A")  || ISPICKVAL(Status, "B")), Date1__c - TODAY(), Date2__c- TODAY()

How do I let the system choose whether to show the result of the first or second working out?

Answered by anu rhea
You prematurely closed the IF (marked here with "****" around it):

IF(ISPICKVAL(Status, "A") || ISPICKVAL(Status, "B")****)****,
Date1__c - TODAY(),
Date2__c- TODAY()
Try:
IF(ISPICKVAL(Status, "A") || ISPICKVAL(Status, "B"),
   Date1__c,
   Date2__c) - TODAY()

This includes DerekF's recommended optimization of pulling out subtracting today.



Your Answer

Interviews

Parent Categories