Automating Excel Spreadsheet Report Titles

By David H. Ringstrom, CPA



Many users tire of retyping report titles such as “For the Period Ended October 31, 2012” month after month. Further, if you're like me, sometimes printing the report reminds you that the title needs updating. I'll explain a couple of techniques you can use to simplify, and even automate, such date-based report titles.


Let's first assume that each month you'll enter a date, such as 10/31/12, into cell A1. We can transform this into “For the Period Ended October 31, 2012” with a simple formatting trick. In Excel 2007 and later, click the Format Cells: Number button on the Home tab, as shown in Figure 1. This displays the Format Cells dialog box shown in Figure 2. (In Excel 2003 and earlier, choose Format, and then Cells.)


Figure 1: The Format Cells: Number button displays the Format Cells dialog box.



Within the Number tab of the Format Cells dialog box, choose Custom, and then enter the following text in the Type field:


“For the Period Ended” mmmm d, yyyy


Figure 2: A custom number format can transform a date like 10/31/12 into a report title.



Be sure to place double quotes before For, after Ended, and include a space before mmmm. The four m's within the format signify that we wish to convert a numeric month to its equivalent month name. The d displays the day portion, the date that we input in cell A1, and yyyy presents a four digit year. Although I could use mmmm d, yyyy on its own as a custom format to spell a date out in long form, in this case, I enclosed additional text in quotes. Going forward, you can simply type a new date in mm/dd/yy format and the title will update automatically.


Figure 3: The report date can be updated by typing a new date in cell A1 in mm/dd/yy format.



Assuming that your report dates are always the last date of the previous month, you can completely automate your report title with a simple formula. To do so, we'll use the DATE function, along with the YEAR, MONTH, and NOW functions.


The DATE function has three inputs: year, month, and day. The YEAR and MONTH functions each accept a date as their only reference. The NOW function returns today's date, and so use these functions together as shown in Figure 4:


=DATE(YEAR(NOW()),MONTH(NOW()),0)
To break the formula down, I placed the NOW() function inside the YEAR and MONTH functions, respectively. This gives me the year and month for today's date. Although I could use Excel's DAY function to extract the day portion of a date, in this case, I used a zero instead. Doing so instructs Excel to return the last day of the preceding month. Couple this formula with the aforementioned custom number format, and you'll never need to update that report title again.


Figure 4: The combination of the DATE function and a custom number format automates your report title.



A previous version of this article first appeared on www.accountingweb.com .


About the author:

David H. Ringstrom, CPA heads up Accounting Advisors, Inc., an Atlanta-based software and database consulting firm providing training and consulting services nationwide. Contact David at david@acctadv.com  or follow him on Twitter. David speaks at conferences about Microsoft Excel, and presents webcasts for several CPE providers, including AccountingWEB partner CPE Link