Sunday, March 2, 2008

Homework

The Choose function in Excel uses its first argument to look up into a list formed by the rest of the arguments. Thus, Choose(1, 6, 7) will give 6, while Choose(2, 6, 7) will give 7. You can use Choose with the first argument being the month number (1 through 12) and the next twelve arguments being the number of days in the month. Remember, 30 days has September, April, June, and November. All the rest have 31. Except for February, which in a leap year has 29, but otherwise has 28. Don't worry about leap years. Pretend that this year is not a leap year.

Thus, you can write a formula which will look up a month and give you the number of days in that month.

Next, instead of specifying manually what the month number is, use the Excel MONTH function to extract the month number from some date.

Now, know that if you add the number of days in the month to a date within that month, you will arrive at the same day of the month, but in the next month.

So, put a date into A1. In A2, write a formula using the above information, which will be the same day of the month, but the next month. 1/6/08 will become 2/6/08. And 7/7/08 will become 8/7/08. This is different than just adding the number 30 to the previous date.

No comments: