Excel Tips : How to play with Days in Excel

PRAVEEN KUMAR (MBA (Finance) B.Com.(P))   (3443 Points)

10 February 2010  

 

Excel Tips : Auto Filling with Weekdays

 

 

 

 

 



AutoFill feature of Excel is very handy, allowing you to automatically fill cells with all sorts of information, based on the content of cells you select. For instance, if you fill two cells with the words "Monday" and "Tuesday," and then select those cells, you can drag the AutoFill handle to fill other cells with other days of the week.

What if you want to only fill cells with the workdays, Monday through Friday? This is easy to do if you make one small change in how you use the AutoFill handle. Instead of clicking and dragging it with the left mouse button, click and drag with the right mouse button.

When you release the button, a Context menu appears. Two of the options on the menu are "Fill Days" and "Fill Weekdays." If you choose Fill Days, then the range is filled with the names of the seven days of the week, the same as if you had used the left mouse button to do the AutoFill. The other option, Fill Weekdays, fills the range with the names of only the five days of the week, Monday through Friday.

 

     

Excel Tips : Leap Years and Fiscal Periods

 

 



A Company's Fiscal year can end at any time, not just when a calendar year ends. When putting together a worksheet, you may want to calculate a date that is one year before or after a given date that represents the end of a fiscal period. This can be done quite easily with any number of formulas, such as the following:

=DATE(YEAR(D1)-1, MONTH(D1), DAY(D1)) 

This formula takes a date (cell D1) and subtracts a year from it. Thus, if D1 contains the date 6/30/10, then the formula returns 6/30/09.

This works great in most instances because most months have the same number of days from one year to the next. There is, of course, one exception—February. If you have a fiscal year that ends in February, the variable number of days in the month can play havoc with the above formula. If cell D1 contains 2/28/09, then the formula returns 2/28/08, when the real end of the fiscal period is 2/29/08. Similarly, if cell D1 contains 2/29/08, then the formula returns 3/1/07, which is obviously not what was intended.

There are a couple of ways you can determine the end of the fiscal period. The first is through the use of the EOMONTH function. This function is used to return the end of a month a given number of months in the past or future. For instance, if you wanted to know the last day of the month twelve months ago, you can use the following formula:

=EOMONTH(D1,-12) 

The EOMONTH function is built into Excel 2007. In previous versions of Excel it is part of the Analysis ToolPak, so you will need to make sure you have it installed and enabled on your system.

In some instances you might not want to use EOMONTH. For example, you might be distributing the workbook to others, and you are not sure if they have the Analysis ToolPak installed on their system. In such instances you could use the following formula:

=DATE(YEAR(D1)-1, MONTH(D1)+1, 0) 

This formula, just like the EOMONTH function, returns the end of the month for exactly one year ago. Another formula to return the end of month one year ago is as follows:

=D1-365-(DAY(D1)<>DAY(D1-365))