Saturday, February 28, 2009

SharePoint List formula to calculate Month and quarter from date value.

SharePoint List formula to calculate Month and quarter from date value, where Date is the column name of type "Date and Time"

1. Year

Formula :
=YEAR(Date)

2. Date

Formula:
=DAY(Date)

3. Month

Formula :

=IF(MONTH(Date)=1,"January","")&
IF(MONTH(Date)=2,"February","")&
IF(MONTH(Date)=3,"MARCH","")&
IF(MONTH(Date)=4,"April","")&
IF(MONTH(Date)=5,"May","")&
IF(MONTH(Date)=6,"June","")&
IF(MONTH(Date)=7,"July","")&I
F(MONTH(Date)=8,"August","")&
IF(MONTH(Date)=9,"September","")&
IF(MONTH(Date)=10,"October","")&
IF(MONTH(Date)=11,"November","")&
IF(MONTH(Date)=12,"December","")


4. Quarter

Formula:

=IF(MONTH(Date)<=3,"Q1",
IF(MONTH(Date)<=6,"Q2",
IF(MONTH(Date)<=9,"Q3",IF(MONTH(Date)<=12,"Q4",""))))