Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone
I have a script line that will return a 1 or a 0 based on the date falling in the next month. The problem I have is when it gets to December, where the script below will return the year 2013 for todays date, not 2014.
I can see why it does it but I was wondering how I could get around it - I was thinking of putting in an IF statement (where if the month is 12 then +1 to the year) - but is there a smarter way of doing it? Thanks for any help!
( Month(Addmonths(Today(),1)) =Month([Promised Payment Date]) AND Year(Today())= Year([Promised Payment Date]), 1, 0)
if(InMonth([Promised Payment Date], today(), 1), 1, 0)
This says if [Promised Payment Date] is in the month after today (denoted by the 1).
Just changed your Year condition to have greater than or equal to and added add months
= if(Month(Addmonths(Today(),1)) = Month(date('01/23/2014','MM/DD/YYYY')) AND Year(Addmonths(Today(),1)) >= Year(date('01/23/2014','MM/DD/YYYY')),1, 0)
try
=If (fabs(Month([Promised Payment Date]) - Month(Today())) =1, 1,0)
Please try with MonthStart or InMonth functions like below:
Method 1: MonthStart
Let vDateCheck = Num(MonthStart(AddMonths(Today(),1))) ;
IF(MonthStart([Promised Payment Date]) = $(vDateCheck) , 1, 0) AS NextMonthYr_Flag
Method 2: InMonth
IF(InMonth([Promised Payment Date], Today() , 1) , 1, 0) AS NextMonthYr_Flag