SharePoint Blogs / SharePoint University
SharePoint Blogs and SharePoint University - all in one place!
Need SharePoint Training? Attend a SharePoint Bootcamp!

Please delete cookies related to sharepointblogs.com and sharepointu.com to resolve login issues!

Using [Today] in a Calculated Formula (Birthday Lists) - SPS/WSS 2003 NOT MOSS!!
The Boiler Room - Mark Kruger (Moving to http:www.sharepointbloggers.com )

Syndication

News

  • My SharePoint Blog is moving: Mark Kruger's SharePoint Blog @ SharePointBloggers.com Interested in consulting work or becoming a consultant? Contact Me.

    - Quick Links -
    <script> google_ad_client = "pub-5278830398312697"; google_ad_width = 120; google_ad_height = 600; google_ad_format = "120x600_as"; google_ad_type = "text_image"; google_ad_channel =""; google_color_border = ["336699","DFF2FD","CCCCCC"]; google_color_bg = ["FFFFFF","DFF2FD","FFFFFF"]; google_color_link = ["0000FF","0000CC","000000"]; google_color_url = ["008000","008000","666666"]; google_color_text = ["000000","000000","333333"]; </script>
    <script> google_ad_client = "pub-5278830398312697"; google_ad_width = 120; google_ad_height = 90; google_ad_format = "120x90_0ads_al_s"; google_ad_channel =""; google_color_border = "336699"; google_color_bg = "FFFFFF"; google_color_link = "0000FF"; google_color_url = "008000"; google_color_text = "000000"; </script>
    <script> google_ad_client = "pub-5278830398312697"; google_ad_width = 110; google_ad_height = 32; google_ad_format = "110x32_as_rimg"; google_cpa_choice = "CAAQ0ZGazgEaCNfGe9Y_ARDqKPmNxXQ"; </script>
    - Blog Bits -
     My Professional Profile




    Subscribe in NewsGator Online
    Add to My MSN
    Add to Google

    Subscribe with Bloglines

    <script> var data, p; var agt=navigator.userAgent.toLowerCase(); p='http'; if((location.href.substr(0,6)=='https:')||(location.href.substr(0,6)=='HTTPS:')) {p='https';} data = '&r=' + escape(document.referrer) + '&n=' + escape(navigator.userAgent) + '&p=' + escape(navigator.userAgent) + '&g=' + escape(document.location.href); if(navigator.userAgent.substring(0,1)>'3') {data = data + '&sd=' + screen.colorDepth + '&sw=' + escape(screen.width+ 'x'+screen.height)};document.write(''); document.write(''); document.write(''); </script>
    <script> var AFS_Account="00721733"; var AFS_Tracker="0009"; var AFS_Server="www7"; var AFS_Page="SharePoint Blog"; var AFS_Url="http://www.sharepointblogs.com/mkruger"; </script> <script> </script>


    Tags:

    Translate Text or URLs
    <script> _uacct = "UA-67892-3"; urchinTracker(); </script> Who links to my website?

 

Using [Today] in a Calculated Formula (Birthday Lists)


For the last time, this is not MOSS!

 

Ok, we all know that SharePoint loves to complain about how you can't use [Today] in a calculated column…

 

"TODAY - Returns the serial number of the current date. The serial

number is the date-time code used for date and time

calculations.

Note  You can only use the TODAY function as a default

value; you cannot use it in a calculated column.")

 

Well, I can't take credit for this one but I found this thread in the forums by a gentleman named Pete Blair... I also was watching a thread at SharePointU so I thought it was worthy of a Blog post to answer once and for all! ;)

It is possible to use "Today" in a function as a reference to today’s date

(despite what SharePoint tells you).  There is a very simple work around that

doesn't involve very much effort or complexity.

 

  1. First, create a new column in your list with the column name of "Today".  
    Click "OK".  (It doesn't matter what type of column or data it is, this is
    just a place holder and will be removed later).
    MK Note: Create column called Today... I also created a column called DOB (date field) where I will enter the birth date.
  2. Next, create a column with the data where you would like to use "Today" as a
    reference to today’s date.  The column type should be "Calculated".  In the
    formula field, create your formula using "Today" as if it held the column date/time.
    SharePoint will calculate the formula based on the assumption that you will
    be using "Today" as a reference to the new column you just created.
    MK Note: I created a column called MonthCheck with the formula shown below:
     =IF(MONTH([Today])=MONTH([DOB]),"Birthday","NotBirthday")
  3. Next, edit the new column named "Today" that you created in the first step.  
    On the very bottom of the page,
    click "Delete", to delete the column.  In
    your formula, SharePoint will keep the reference to "Today" but it will
    change from referencing your column, to a reference to the current date.
  4. MK Note: Now you can create your new view in the list to display “This Month's Birthdays“.  Just apply a filter to Show only when the following is true: MonthCheck is equal to Birthday
    I've also created a BirthDay Column (Capitalized the “D“ to note the difference) as well that is a calculated column: =DATE(YEAR(Today),MONTH(DOB),DAY(DOB))
    You can then create a view to display Today's Birthdays by filtering to Show only when the following is true:
    BirthDay is equal to [Today]

 

This can be used in any of the Date and Time functions, but I haven't tested

it beyond that.

 

Notes:

If you want to edit the formula (CheckMonth) containing "Today" SharePoint will not let

you, and will give you the same error about not using Today or Me in a

function.  To get passed this problem you have to temporarily create another

Today column (and then delete it again).

The same functionality will also work with [Me].

 

Ted Tang has a great post on using “< MONTH />” by making modifications within FrontPage:How to ONLY Display "This Month" Items in a List


Posted 06-26-2007 11:02 AM by mkruger
Need SharePoint Training? Attend a SharePoint Bootcamp!
Posts (c) their respective authors. Everything else (c) 2009 SharePoint Experts, Inc.