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
Chad RitchieChad Ritchie 

Nested If Formula Not Working

Hey guys,

I appreciate all the help I can get,

Here's my formula :

IF(ISBLANK(IF(Length_of_Strategy_String__c <50,(LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),IF(AND( Length_of_Strategy_String__c >50, Length_of_Strategy_String__c <56),(LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),IF( Length_of_Strategy_String__c >56,(LEFT( Strategy_just_used_for_update_email__c , LEN(Strategy_just_used_for_update_email__c ) - 4)))))),IF(Length_of_Strategy_String__c <50,(LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),IF(AND( Length_of_Strategy_String__c >50, Length_of_Strategy_String__c <56),(LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),IF( Length_of_Strategy_String__c >56,(LEFT( Strategy_just_used_for_update_email__c , LEN(Strategy_just_used_for_update_email__c ) - 4))))),GAI)

And here's the error:  Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 2

I know it's very close, I just can't figure out where the error's coming from.

Thanks!

 
Best Answer chosen by Chad Ritchie
Jolly_BirdiJolly_Birdi
Hello @Chad

You haven't written the Else condition of the bold if statement. Check it out:

IF(    ISBLANK(IF(Length_of_Strategy_String__c < 50,
                (LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),
                IF( AND(Length_of_Strategy_String__c >50, Length_of_Strategy_String__c <56),
                    (LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),
                    IF( Length_of_Strategy_String__c >56,
                        (LEFT( Strategy_just_used_for_update_email__c , LEN(Strategy_just_used_for_update_email__c ) - 4)),
                        //Add Here Else Condition
                    )
                )
            )
    ),
    IF(Length_of_Strategy_String__c <50,
        (LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),
        IF(AND( Length_of_Strategy_String__c >50, Length_of_Strategy_String__c <56),
            (LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),
            IF( Length_of_Strategy_String__c >56,
                (LEFT( Strategy_just_used_for_update_email__c , LEN(Strategy_just_used_for_update_email__c ) - 4)),
                //Add Here Else Condition
            )
        )
    )
    ,GAI
)

Please mark this as best answer if you find it helpful

Thanks,
Jolly Birdi

All Answers

Chad RitchieChad Ritchie
And don't mind the -4s, once it's working those values will be different for each if statement.
Jolly_BirdiJolly_Birdi
Hello @Chad

You haven't written the Else condition of the bold if statement. Check it out:

IF(    ISBLANK(IF(Length_of_Strategy_String__c < 50,
                (LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),
                IF( AND(Length_of_Strategy_String__c >50, Length_of_Strategy_String__c <56),
                    (LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),
                    IF( Length_of_Strategy_String__c >56,
                        (LEFT( Strategy_just_used_for_update_email__c , LEN(Strategy_just_used_for_update_email__c ) - 4)),
                        //Add Here Else Condition
                    )
                )
            )
    ),
    IF(Length_of_Strategy_String__c <50,
        (LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),
        IF(AND( Length_of_Strategy_String__c >50, Length_of_Strategy_String__c <56),
            (LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),
            IF( Length_of_Strategy_String__c >56,
                (LEFT( Strategy_just_used_for_update_email__c , LEN(Strategy_just_used_for_update_email__c ) - 4)),
                //Add Here Else Condition
            )
        )
    )
    ,GAI
)

Please mark this as best answer if you find it helpful

Thanks,
Jolly Birdi
This was selected as the best answer