Group & Sort by Month in List View Trick

Group by month is very simple task to achieve in SharePoint List View.
Simply create one computed column with formula:

=TEXT([Start Time],"mmmm")

Now Group by that view by this field to view in particular order ascending or descending.

SiteColumnView
As shown above, it will only order item by alphabetically for month keyword, but it will not order as per the month ordering.

So to achieve that add following formula:
=REPT(" ",13-MONTH([Start Time]))&TEXT([Start Time],"mmmm")

SortByMonth

What’s the trick? To force the order, we are adding a bunch of white spaces before the month name. The calculated Month actually contains the following values (each _ represents a white space):
____________January
___________February
__________March

__November
_December

Now, why don’t we see these spaces on the Web page? What makes the magic work is that when you insert multiple spaces in a Web page, the html specification says that

user agents should collapse input white space sequences

That’s it!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s