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 isnt 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?

  • 2
    So, what is the issue you're running into? Aside from a missing closing parenthesis at the end (to close the IF()), this formula looks fine to me. If you're getting an error message, you should edit your question to include the full text of the error (don't try to paraphrase it).
    – Derek F
    Apr 20, 2021 at 14:04
  • That's more an issue using IF by the look of it..
    – Phil W
    Apr 20, 2021 at 14:04

1 Answer 1


You prematurely closed the IF (marked here with "****" around it):

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


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

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

  • 1
    I think breaking this out onto multiple lines (and including the original, also broken out onto multiple lines) would help illustrate the issue. Also, OP could save some typing by using the IF to only select the date, then subtract TODAY() once. e.g. IF(condition, date1, date2) - TODAY()
    – Derek F
    Apr 20, 2021 at 14:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .