Group by month, year, or anything else using a calculated column in SharePoint

I found an excellent example of how to group by month in a blog recently. It does require using SharePoint Designer, however. An alternative to grouping this way is to create a calculated column and group on that.

The end result looks something like this:

:

Basically, you just create a new calculated column in the list.  My original column was a DateTime called “Published”.  I created a new calculated column called “Published Month”, type of “string”, with a value of =TEXT(Published,”yyyy-MM”)

After creating the calculated column, just set the “Grouping” for the list. One caveat is that your calculated column is going to be sorted on as well, so it must be in the proper order. For example, the format string “yyyy-MMM”, which produces “2008-Apr”, sorts alphabetically, instead of in date order.

5 Responsesto “Group by month, year, or anything else using a calculated column in SharePoint”

  1. andrew says:

    do you know why i get error if i enter =TEXT(Published,”yyyy-MM”) in the formula?
    the error is “The formula contains a syntax error or is not supported. ”
    I tried with several doc lib and lists on different sites and on 2 MOSS farms

  2. Jörg says:

    The Information was a great help for me. Thanks!

  3. Opo H says:

    I think you should use ; instead of , (that worked for my MOSS 2010

  4. John says:

    How about explaining what “Published” refers to? I assumed it was the column containing the full date, so I substituted “Start Time,” but that didn’t work. Just got the syntax error.

  5. Aaron says:

    “Published” is my original datetime field. I updated the post so it makes more sense. You may have got a Syntax error because SharePoint didn’t recognize the space in the field name. It’s been a while since I posted this, so I’m rusty, but you may have to surround it with square brackets [Start Time] or quotes “Start Time”. Maybe someone else can chime in.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>