April 8, 200520 yr 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.
April 8, 200520 yr Try: Let ( [ startMonth = Month ( StartDate ) ; endMonth = Month ( EndDate ) ; n = endMonth - startMonth + 12 * ( endMonth < startMonth ) + 1 ; list = "January
April 9, 200520 yr 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
April 9, 200520 yr 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
Create an account or sign in to comment