You can easily extend this template by copying the column into empty cells onto the right of the last column of the model.
Below is a row-by-row explanation of the example excel file:
B3: Calculate the first day of the month using any date:
The EOMONTH function gives the last day of a given month. “-1” means goes one month backwards. This gives the last day of the prior month. The +1 adds one more day to the last day of the prior month, which gives you the first day of the current month.
An alternate approach will give the same result:
This uses the DATE function rebuilds the date by entering the same year, month, and “1” for the date parameter. 1 is the first day of the month.
B4: Calculate the last day of the month using any date:
(You can actually replace $B$3 with any date and the function would still work.)
B5: Calculate the current month as a number from any date:
B6: Calculate the year as a number from any date:
B7: Show only the last two digits of the year.
For example, 1995 will show as 95; 2010 will show as 10. To achieve this, first we use the MOD function to find the remainder when the year number is divided by 100. Then use the TEXT function to “zero fill” the number. (Zero fill forces 2001 to show as “01”, instead of just “1”.)
If you want to show ’95 and ’10, then you can modify the formula:
B8: Display date in year-month format (yyyy-mm)
We would use the TEXT function to display the date in a text format.
B9: Calculate the corresponding quarter of using the month
This formula divides the month number by 3 and CEILING always rounds the number up. (Not rounding it to the nearest integer.)
B10: Show the quarter and year of a date.
This formula shows the quarter and year in the form of [Quarter]Q[Year]. For example, first quarter of year 2000 will show as 1Q2000.
B11: Show the quarter and last two digits year of a date.
This would show a date in the short form of [Quarter]Q[Year], where only the last two digits of the year is shown. For example, first quarter of year 2000 will show as 1Q00.
B12: Calculate the number of days in a month.
The formula minuses the last day of the month to the first day of the month, plus one.
If this was a standalone formula without depending on other cells, the complete formula would be:
where B$3 is the cell with the date you are trying to calculate for the number of days in the month.