Link to home
Create AccountLog in
Avatar of Matt Pinkston
Matt Pinkston

asked on

SharePoint Custom List Single Line of Text Calculated Value

In my sharepoint list I have a single line of text field where I am trying to calculate a value...

the field name is title
 
and in the calculated default value I have the following:

=[Report Date]&" - "&[Organization]

I get an error when trying to save

The formula contains reference(s) to field(s).
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

I think your dash is in the wrong place and is being read as a minus sign and it can't subtract non numeric values. I don't see what you are trying to do in the syntax specs, but what I do see is this

=[Column2]&", "&[Column1]

Which will separate your two items with , and a space.

Here's the full reference.
http://msdn.microsoft.com/en-us/library/bb862071%28v=office.14%29.aspx

Maybe you could try adding the dash within one of the two strings if you really even need it. But that raises another point. If you are trying to concatenate these two column values together as one big string, both values have to be strings, so it looks like you would need to convert the date value in Report Date to a string before concatenating unless the language itself is automatically doing that for you. And, make sure the calculated column itself is of type string.
Avatar of Matt Pinkston
Matt Pinkston

ASKER

even if I just try

=[Report Date]

I get The formula contains reference(s) to field(s).
Well, what is the field type of your calculated column? You are trying to add a value of type date to a column (your calculated column), that is probably set to be a numeric or string type. So it won't work. You have to convert the date value to the same type of data that the calculated column is set to expect or set that calculated column's value to type date to accept dates, but then you can't splice that together with the Organization name. If you want to do that, you have to make your calculated column to be type string and convert your Report Date field value to a string before trying to add it together with Organization, which is a string. All players in a calculated column must all be of the same exact data type.

Try this
=TEXT([ReportDate],"d mmm yyyy")  and make sure your calculated column type is set to string. This will convert the date type value of the field to a string that gives you a format of day, month and year, which is the way it will display in the column. Then, add

, "&[Organization]" and see if that works to put the two strings together.

So it would look like this:
=TEXT([ReportDate],"d mmm yyyy")&", "&[Organization]
Dear pinkstonmp,

My fellow experts have indeed got the better of your problem rightly due to the reasons:
1. Either the column you are selecting for calculation is null or empty.
2. The data type of the two selected columns do not match.

I would suggest you go through the below links:
(in general)
http://www.sharepointpanda.com/2009/04/sharepoint-calculated-field-functions-and-formulas/
http://office.microsoft.com/en-us/windows-sharepoint-services-help/introduction-to-data-calculations-HA010121588.aspx

(date functions)
http://blogs.msdn.com/b/sharepointdesigner/archive/2008/08/01/date-functions-in-calculated-fields.aspx
http://weblogs.asp.net/peterbrunone/archive/2009/03/11/calculated-datetime-fields-in-sharepoint-lists.aspx

(programatically)
http://stackoverflow.com/questions/898291/sharepoint-get-value-of-calculated-field-without-manual-parsing

You might be required to merge two different transformations/data conversion techniques to achieve your result.

Enjoy!!!...
When I tried

=TEXT([ReportDate],"d mmm yyyy")&", "&[Organization]

I still got

The formula contains reference(s) to field(s).

when I clicked OK
ASKER CERTIFIED SOLUTION
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer