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
Dman100Dman100 

check if date is greater than current month

I'm trying to create a formula field that returns the value true or a numeric value of 1 (either value would work) where a custom field that is a date/time datatype is greater than the current month

 

I was trying the following, but it is not correct:

 

After Month End (TEXT) = IF(End__c > THIS MONTH, 'true', 'false')

 

I just want to check if the date in the custom field end__c is past the current month and if so, set the value to true or 1.

 

Thanks.

SlanganSlangan
This may do the trick:

 

IF(Month(End__c)>Month(Today()),'true','false')

Dman100Dman100

I tried the following, but the value comes back as false even when the date in the end__c field is beyond the current month.

 

If(Month(DATEVALUE(End__c))>Month(Today()),'true','false')

 

SlanganSlangan

"I tried the following, but the value comes back as false even when the date in the

end__c field is beyond the current month.

 

If(Month(DATEVALUE(End__c))>Month(Today()),'true','false')"

 

 

This equation may have another flaw - when you get to December, it

will show any entries in the following year (such as January) as past due. You need to

compare not just the month but the year as well to make sure this doesn't happen.

 

You may want to try something using the DATE() function to prevent errors when the

end of the year comes. I built this in my sandbox and it worked - hopefully it will solve

your troubles:

 

IF(DATE(YEAR(DATEVALUE(End__c)),MONTH(DATEVALUE(End__c)), DAY(Today()))>Today(), 'true','false')

 

 

LStraubLStraub

Hi Slangan,

 

I have a need for this type of date check but i'm getting a error using your formula.   Please note I'm a complete dummy when it comes to these things so i'm sure its me. In the opportunities object I need a formula that checks to see if the the"Close Date" is greater then today AND the "Stage" is 0-9. We have 10 stages all together.  Basically if its close/won they cant back date that close date.  If both of those checks are true they can not make the close date anytime in the past.

 

I have been modifying your formula just to try and get the date checking working before i add the Stage checking and I am getting an Error: Incorrect argument type for function DATEVALUE().  I'm sure it is because I am clueless.  here is what i have.  could anyone give me a hand on how to get this working?

 

IF(DATE(YEAR(DATEVALUE(CloseDate)),MONTH(DATEVALUE(CloseDate)), DAY(Today()))>Today(), 'true','false')

 

thanks in advance to anyone kind enough to offer suggestions!!