20 April 2020

How do I - Format a numerical value in a calculated SharePoint field?

If we remember our SharePoint Power Tip on calculated fields, then we'd know we can use Excel formulas to make this work the way we want.  In my case, I was trying to display the age of a ticket in days, on it's InfoPath customized form.  Sounds easy enough right?

NOW() - Created

That should do it, right?
Unfortunately, that displayed a value with fractions.  Not quite what we want.  OK, so let's just round the thing then, and while we're at it, round it to 0 decimals thus:

ROUND(NOW() - Created, 0)

Alas, that did not do it either.  Hopping into Excel, I used text formatting to achieve the goal.  The final calculation was:

=TEXT(ROUND(NOW() - Created, 0), "0")

Happy coding.
C

No comments:

Post a Comment

Comments are moderated only for the purpose of keeping pesky spammers at bay.

Microsoft Authentication Library (MSAL) Overview

The Microsoft Authentication Library (MSAL) is a powerful library designed to simplify the authentication process for applications that conn...