Wednesday, January 16, 2008

Calculated column to display month name from a date

I was haing a requirement to display the month name from the selected date like January, February etc. I have created a calculated column and used a formula to display the month name.

Create a custom SharePoint list and a date column, a calculated column to it and other columns to it. For the demonstration purpose, I have created a list “Employee List”, with “Emp ID”, “Employee Name”, “Joining Date”, and “Month Calculated” columns. Here “Month Calculated” is the Calculated Column.




Above image shows the column details of "Employee List".

In the Calculated Column, use the following formula to get the month name from the “Joining Date” column.


=TEXT([Joining Date],"MMMM") -- To Display “January”, “February”, etc
Or
=TEXT([Joining Date],"MMM") -- To Display “Jan”, “Feb”, etc






Above image shows the “Month Calculated” calculated column.


Once the columns added to the List, Add new items by clicking “New”.



After selecting the “Joining Date” Click ok. Now the calculated column will display the month name for the selected “Joining Date”.




3 comments:

Joshua said...

Hello, this text formula does not work for me. I am using InfoPath forms services and connect to a forms library. I want to be able to group how many forms were filled out in Jan, Feb, etc. I created an additional field for month in the browser and used the same formula based on Created date. However, if I fill out a form today it should store as February for this field. However, it shows up as December. Any advice on how to fix this appreciated.

Yusuf Baker said...

Thanks..work like a charm!

Doreen said...

Fabulous! This solved a problem I was having with grouping on fields I promoted from InfoPath form. I was trying to create the fields using rules from a datetime field but the rules to create the month name were only sporatically working plus I had to relink or modify all existing (4000+) forms to the modified form template for the values to appear. Your way allows the values (in my case, month and year) to show up immediately with no further tweaking! Yeah!