This page is an advertiser-supported excerpt of the book, Learn Excel 2007-2010 from MrExcel - 512 Excel Mysteries Solved. If you like this topic, please consider buying the entire e-book.
Format Dates As Quarters or Weeks
Problem: Why don’t the date formats offer quarters or weeks?
Strategy: The TEXT() function in Excel will not let you display quarters or weeks. However, the FORMAT() function in VBA will let you display quarters and weeks. For a quick primer on setting up a VBA function to use this formatting, go to your browser and search for “Learn Excel 1074".
I realize that VBA scares people. I generally don’t include tricks in this book that require VBA. I’ve written other books that include only VBA. However, given that you can get amazing results from 3 lines of VBA code, this trick makes the cut.
Figure 533 Use a VBA function to format as quarters or weeks.
Figure 534 Three lines of code enable the Quarter and Week trick.