Paul Galvin's (old) SharePoint space [SharePoint

Just another site

WSS, doc libs & lists, Calculated columns involving [Me]

Someone on the Internets was asking about how to create a calculated column on a list that would show a value formatted as "[User] – [Status] – [Location]" as in "Paul Galvin – Drinking [free] Beer – The Beach".

Paul would go in and update his entry in the list and the calculated column would update appropriately.  The [User] should default to the the user entering/updating the list.

A calculated column cannot use "volatile" functions such as [Me] or [Today].  I solved it in a test environment with these steps:

  1. Create a text column named "Current User".
  2. Set its default value to [Me]
  3. Create a calculated column called "Calc Test".
  4. Set its value = [Current User]

I went in, added an item to the list and it worked.


9 responses to “WSS, doc libs & lists, Calculated columns involving [Me]

  1. Drew September 21, 2007 at 7:13 am

    Paul,Thank you for that solution.  It worked great.  Expanding on your solution, would you have any idea how to set calc test = Current User if you want current user to be a People Picker field with only people selected? Thanks again.Drew

  2. Paul September 21, 2007 at 7:56 am

    Sadly, I don\’t see any way to do that without writing an event handler.  Even If change the presentation of the "Person or Group"  to simple "Name" (as opposed to the more complex "Name with Presense") it is still disallowed.
    –Paul Galvin

  3. Patrick September 27, 2007 at 4:12 am

    I did your tirck Paul.But when i view the list i see only [Me] and not my username.
    When i created the calculated column i set it to [Current User] using the formula add button.
    Is that right?
    Let me know

  4. Patrick September 27, 2007 at 4:22 am

    It did work now but had to add a new item couple of times

  5. Unknown August 27, 2008 at 6:31 am

    I\’m trying to use a CAML query against the Sharepoint web services in order to filter the items modified by [Me] and some other options. Do you know how to do that because I haven\’t found anything yet?.
    I\’ve tried GetListItems with the filtering query and a view that has a filter with  Modified By = [Me], but the view is ignored when using a query.

  6. Unknown September 8, 2008 at 11:43 pm

    Am I missing something? Your example shows the user name in clear ("Paul Galvin"), but when I test this I actually get the login (which somehow defeats the purpose, as announcing that "DOMAIN\\username is drinking a beer" doesn\’t sound that cool…).

  7. Richard November 18, 2008 at 3:38 pm

    Hello Paul,Without meaning to I think you just figured out a way to get around a serious InfoPath/SharePoint issue I have been having.Basically I can get the domain\\username of users but then cannot use [Me] filters and other powerful SharePoint functionality. But by using something like this, it should work around that issue, by allowing me to compare two text columns (single line) rather than a people and groups column.Time to give it a try.Thank you,Richard Harbridge

  8. Richard November 18, 2008 at 3:42 pm

    Darn. Doesn\’t look like I can get that \’workaround\’ to show the user information in the column.

  9. Unknown November 22, 2008 at 9:18 am

    I don\’t think (but have not verified) this will work in SharePoint 2007 – a calculated column is only updated when the item is edited so in this case [Me] will always be the user who last edited the item.The same trick using [Today] no longer works – see this post for more details

Leave a Reply

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

You are commenting using your 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

%d bloggers like this: