How to calculate if Date is more than "2 years ago" with a Salesforce formula field?
Asked Answered
O

1

5

I need to calculate in a custom field if a Date is more than 2 years ago ... if so then return a YES or if it is not then return a NO

I'm trying this formula, making the return type "text" Last_won_deal_date__c > DATEVALUE("2 years ago") but it's giving the following error:

Error: Formula result is data type (Boolean), incompatible with expected data type (Text).

Oscular answered 8/10, 2019 at 19:4 Comment(0)
O
7

There are lots of sample formulas that could get you started: https://help.salesforce.com/articleView?id=formula_examples_dates.htm&type=5 (check the "Finding the Number of Days Between Two Dates" part)

Try IF(Last_won_deal_date__c < TODAY() - 2 * 365, 'YES', 'NO') or some variations of it.

Osorio answered 9/10, 2019 at 7:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.