Merit Solutions Posted April 8, 2005 Posted April 8, 2005 OK - what I want to do seems straightforward but it is driving me crazy! I have a start date and end date of an event. Say start date is : 19/1/05 and end date is 15/4/05. I want a field to store month values for all months this event covers. ie: January, February, March and April. These need to be separated by carriage returns (for formatting as a check box set). Any help is appreciated.
comment Posted April 8, 2005 Posted April 8, 2005 Try: Let ( [ startMonth = Month ( StartDate ) ; endMonth = Month ( EndDate ) ; n = endMonth - startMonth + 12 * ( endMonth < startMonth ) + 1 ; list = "January
BobWeaver Posted April 9, 2005 Posted April 9, 2005 Comment, you only partially accounted for durations which cross into a new year. You will need to modify the formula to this: Let ( [ startMonth = Month ( StartDate ) ; endMonth = Month ( EndDate ) ; n = endMonth - startMonth + 12 * ( endMonth < startMonth ) + 1 ; list = "January
comment Posted April 9, 2005 Posted April 9, 2005 Thanks for catching that. As long as we are at it - it's also possible to start in December 2003 and end in January 2005. So let's make it: Let ( [ startMonth = 12 * Year ( StartDate ) + Month ( StartDate ) ; endMonth = 12 * Year ( EndDate ) + Month ( EndDate ) ; n = endMonth - startMonth + 1 ; startPos = Month ( StartDate ) ; list = "January
Merit Solutions Posted April 11, 2005 Author Posted April 11, 2005 Thanks a lot guys (girls?) it worked a treat!!!
Recommended Posts
This topic is 7234 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now