SharePoint Calculated Columns with Dates
I recently had a request to create a view on a list and group the view by the year and quarter of a particular date. i.e. the list in question has a date column, say "Start Date", and the view should be grouped by the year of the date e.g. 2007, and then by the quarter i.e. 1, 2, 3, or 4 depending on the month.
I did this by creating two new calculated columns on the list. The first column is called "Year", is of type "Single line of text", and has the formula shown below:
I created this column as a single line of text instead of a numeric column because a numeric column would show the year "2007" as "2,007" with a comma in it which I didn't want.
The second column is called "Quarter", is of type "Number", and has the formula shown below:
Hopefully someone will find these useful as there isn't a whole lot of information out there on the format and syntax of the calculated columns. However, some good examples can be found here.