Hello I've been trying to create a formula that will calculate days since purchase date only when the checkbox approved is checked as true. I've tried the following in a number formula.

    Approvedcheck__c = True
TODAY () - Sale_Date__c

I cannot find anything online.

1 Answer 1


Formula Operators and Functions is a very good resource to reference.

From that, on the IF() function

Determines if expressions are true or false. Returns a given value if true and another value if false. Use

IF(logical_test, value_if_true, value_if_false) and replace logical_test with the expression you want evaluated; replace value_if_true with the value you want returned if the expression is true; replace value_if_false with the value you want returned if the expression is false.

All of those arguments are required, and the true/false results need to have the same type.

Also, <boolean value> = true can always be reduced to just <boolean value>. Likewise, <boolean value> = false can be reduced to just NOT(<boolean value>)

The general recommendation is to format formulas like code (one line only contains a single expression, indent an additional level after encountering an open parenthesis).

So what you're looking for is

    TODAY() - Sale_Date__c,
    /* The "else" value needs to be the same type, so we use 0 */

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.