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
Kristopher TurekKristopher Turek 

Date field Formula Question

I currently have a date field "Invoice 1" and a formula field "Invoice Created Date" - the formula field is simple - "Invoice 1" - 30 to set the created date as 30 days before the due date of the invoice... however we need to make sure the Invoice created date does not get set for dates in the past.. how do I create a formula that says..if the Invoice 1 date is less than 30 days set as today else set as - 30?
Best Answer chosen by Kristopher Turek
Akhil AnilAkhil Anil
Hi Kristopher,

So your formula will be like this.
 
IF(Invoice_1__c - TODAY()  < 30,TODAY(),Invoice_1__c - 30)

If it works for you kindly mark it as an answer !

All Answers

Chris ShadeChris Shade
Hi Kristopher,

I believe this formula is what you requested: 

IF(TODAY()- Invoice_1__c <30,TODAY(),Invoice_1__c -30)

I assume Invoice_1__c is the API name of your "Invoice 1" field.  The function "TODAY()" gives the current date.  The formula is saying if the "Invoice 1" date is within 30 days of today when use today's date otherwise use "Invoice 1" minus 30 days.

If that response helps you please "Like" my comment.

Chris
Akhil AnilAkhil Anil
Hi Kristopher,

So your formula will be like this.
 
IF(Invoice_1__c - TODAY()  < 30,TODAY(),Invoice_1__c - 30)

If it works for you kindly mark it as an answer !
This was selected as the best answer
Kristopher TurekKristopher Turek
i will try this route... the previous formula expressed just made everything today
Kristopher TurekKristopher Turek
another question off of this.. now say that we have added a field "Payment_terms__c" and the "Invoice_1__c - 30" will now be dependant on a picklist value - 30, 45, 60.. 
Kristopher TurekKristopher Turek
not sure if this will be answered now that I resoved this quesiton... but another question off of this.. now say that we have added a field "Payment_terms__c" and the "Invoice_1__c - 30" will now be dependant on a picklist value - 30, 45, 60..