0

I keep on receiving the error Error: Syntax error. Extra ',' on the following formula field, can you please advise me?

IF(
    NOT(ISBLANK(Last_Email_Received__c)), 
    IF(
        (ISBLANK(Last_Email_Sent__c)), 
        IF(
            Last_Email_Received__c + 2 < NOW(), 
            'Time Exceeded', 
            ''
        )
    ),
    IF(
        Last_Email_Received__c + 2 < NOW(), 
        'Time Exceeded', 
        ''
    )
),
IF(
    NOT(ISBLANK(Last_Email_Received__c)), 
    IF(
        NOT(ISBLANK(Last_Email_Sent__c)), 
        IF(
            Last_Email_Received__c + 2 < Last_Email_Sent__c, 
            'Time Exceeded', 
            'Yes'
        ),
        IF(
            Last_Email_Received__c + 2 < Last_Email_Sent__c, 
            'Time Exceeded', 
            'Yes'
        )
    )
))
5
  • What is the use case that you are trying to achieve with this formula? Commented Mar 16, 2023 at 11:12
  • I need to show if the last email was responded within 48 hours or not. We already have these two fields that are linked to WF rules that get updated when a new email is received or sent. I just need to display a text in relation to them.
    – Francesca
    Commented Mar 16, 2023 at 11:18
  • Formatting your formula according to best practice (group things into independent "statements", break them out onto their own lines, indent an extra level each time you encounter a ( ) as I have done for you this time should always be your first step when trying to debug a formula. Our brains just don't handle a bunch of parenthesis well, so it's ridiculously easy to misplace an open or close paren.
    – Derek F
    Commented Mar 16, 2023 at 11:45
  • Also, when you're running into an error message and looking for help with it, you should always copy/paste the error message here (verbatim, trying to shorten or paraphrase error messages almost always means you're removing important information).
    – Derek F
    Commented Mar 16, 2023 at 11:46
  • Derek, the error message has been added to the question. Thank you for advising.
    – Francesca
    Commented Mar 16, 2023 at 12:04

1 Answer 1

0

I see a parenthesis that shouldn't have been

Here is the corrected code:

IF(
    NOT(ISBLANK(Last_Email_Received__c)) && NOT(ISBLANK(Last_Email_Sent__c)), 
        IF(
            Last_Email_Received__c + 2 < Last_Email_Sent__c, 
            'Time Exceeded', 
            'Yes'
        ),
        IF(ISBLANK(Last_Email_Sent__c),
            'No email Sent', 
            IF(ISBLANK(Last_Email_Received__c),
            'No email Received',
            ''
            )
        )
)
3
  • 1
    Thank you! I have this error now Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 2
    – Francesca
    Commented Mar 16, 2023 at 13:11
  • I received the same error unfortunately
    – Francesca
    Commented Mar 16, 2023 at 13:26
  • I write again the code grouping if
    – arnaud
    Commented Mar 16, 2023 at 13:44

You must log in to answer this question.

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