Forum Discussion
- MarkShnierQrew CadetTry this
var number YYYY = If(Month([Start Date])>=5,Year([Start Date])+1,Year([Start Date]));Date($YYYY,4,30) - DarleneDarleneQrew MemberWorks beautifully! Thanks so much!
- GeorgeBramhall1Qrew MemberWhat's wrong with this formula? Trying too produce a year end date in the year my [Bound Date] is in is in. Also another formula needed for the end date of the following year that the [Bound Date] is in
var number YYYY = If(Year([Bound Date])=Year(Today), Year(Today)+1,Year(Today)+1);Date($YYYY,12,31) I am sure this is a more complicated formula than I need. - QuickBaseCoachDQrew CaptainBased on what you say you are looking for, try this
var number YYYY = Year([Bound Date]);
Date($YYYY,12,31)
The formula for the next year would be
AdjustYear([my other date field], 1) - GeorgeBramhall2Qrew CadetPerfect, however, I forgot to mention that if [Expiration date] is not in current year, then end date is 12/31/YYYY, other wise it's [Expiration Date]. How do I add this criteria? And while I have you, I need another field that tells me how many months left in the current year from the Bound Date, if expiration date is not in the current year.
- QuickBaseCoachDQrew CaptainTry this
IF(Year([Expiration date])<> Year(Today()), Date(Year(Today()),12,31), [Expiration date]))
As for your second question, you will need to give some examples of the calculation as I'm not understanding the "ask". - GeorgeBramhall2Qrew Cadet# of months between [Date End of this Year] - Today() or [Expiration Date if this year] - Today()
So end of Year is 12/21/2019 and Today() is 7/30/19 then # of months = 6 months. - GeorgeBramhall2Qrew Cadetfirst formula above works perfectly, thank you.
- QuickBaseCoachDQrew CaptainI have not tested this lately, but I had it saved in my cheat notes. Let me know if it tests OK.
var date SD= Today();
var date ED= IF(Year([Expiration date])<> Year(Today()), Date(Year(Today()),12,31), [Expiration date]));
(Year($ED)-Year($SD)-1)*12 // start off with 12 times the number of fully completed years
+If(Month($ED)>=Month($SD),12,0) //add 12 months if the last year was fully completed
+ If((Month($ED)>=Month($SD)),Month($ED)-Month($SD),12+Month($ED)-Month($SD)) // add the number of months between the month numbers.
-If(Day($ED)<Day($SD),1,0) // but if the day did not catch up to the start date's day number, then subtract 1. - GeorgeBramhall2Qrew CadetError with this formula where [Bound Date] = $SD:
var date ED= IF(Year([Expiration Date 1])<> Year(Today()), Date(Year(Today()),12,31), [Expiration Date 1]));
(Year($ED)-Year([Bound Date])-1)*12 // start off with 12 times the number of fully completed years
+If(Month($ED)>=Month([Bound Date]),12,0) //add 12 months if the last year was fully completed
+ If((Month($ED)>=Month([Bound Date])),Month($ED)-Month([Bound Date]),12+Month($ED)-Month([Bound Date])) // add the number of months between the month numbers.
-If(Day($ED)<Day([Bound Date]),1,0) // but if the day did not catch up to the start date's day number, then subtract 1.- QuickBaseCoachDQrew CaptainCan you help yourself by posting the complete error message including the words of the error and where it is underlined?