4

I have created a calculated field for a content type in my Sharepoint 2010 and I want to return a date in the TEXT format because I am returning some text with it. The condition I have put in the formula is:

IF(
    AND([ShowModifiedDate];[ShowCreatedDate]);
    "Create date is [Created] and update date is [Modified]";
    IF(
        [ShowModifiedDate];
        [Modified];
        IF(
            [ShowCreatedDate];
            [Created];
            [ArticleDate]
            )
        )
    )

Here I have to return the result in "Single Line of Text" instead of "Date time". I have tried TEXT function (TEXT([Modified],"dd-mm-yyyy")) for the same but it's always giving an error "The formula contains a syntax error or is not supported.". But I can't see any error in the query which I am returning. I have all the columns present in the list.

Even though if I write below thing in formula it's returning me the same error..

TEXT([Modified],"dd mmm yyyy hh:mm ")

Any help would be appreciated.

3 Answers 3

3

Did you put the "=" in front of the formula in the calculated field?

See pictures below, it worked for me

formular display

2

If as DateTime its working fine then you can also use the following to get the text

DAY(Modified)&"-"&MONTH(Modified)&"-"&YEAR(Modified)
0

It seems like you're mixing semicolon separators ; (in your main formula) and comma separators , (in the TEXT function).

It's also worth double-checking all your field names are correct: It may be a translation difference, but the [Changed] and [Change] fields are usually called [Modified].

3
  • Thanks for pointing the , and ; issue. But the machine is setup for the DK environment where I have to provide ; instead of , . And the field name there is Changed. Sorry for typo error above. :(. The exact field name is "Oprettet" in DK. Here I have translated the field name. Any other help is highly appreciated. IF I am using the filed with DateTime in formula then it's returning me the correct result. So it means the field is also doing good.
    – Ankit
    Sep 17, 2012 at 11:53
  • So you've changed the , inside the TEXT call to a ; you're saying? It might help to post the entire broken formula, to clarify the problem.
    – Stu Pegg
    Sep 17, 2012 at 14:23
  • here is the formula which I am using into formula field. IF(AND([Visskabedato];[Visopdateringsdato]);"Create date is [Oprettet] and update date is [Ændret]";IF([Visskabedato];[Oprettet];IF([Visopdateringsdato];[Ændret];[Artikeldato]))). But now I have done this thing in another way. I have used this article (corypeters.net/2008/06/…) to hide and show the publishing control.
    – Ankit
    Sep 18, 2012 at 6:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.