SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on a workflow for a financial organization. To calculate a commission in one currency, I divide the amount in another currency by the exchange rate, which I then convert to text, and put in a word document. However, often end up with rather long numbers like 1.23233434. How can I round this number before it enters the contract? I want to round to two decimals.

share|improve this question

To add to the answer of Dafalgor, you don't have to use SharePoint designer to get the rounded number. You can just create a calculated column referencing another column which stores your long number and just use the calculated column for your word document.

share|improve this answer

Have you tried the ROUND function?

For example: =ROUND(number,2)

See more information here:

http://office.microsoft.com/en-us/windows-sharepoint-services-help/round-function-HA001161059.aspx

share|improve this answer
    
Thank you, I know this function from Excel, but how do insert it in my workflow in SharePoint Designer (2010)? – Daan Apr 25 '13 at 14:12
    
I have found evidence suggesting that you cannot the same formula's from SharePoint in Workflows. See following link: social.msdn.microsoft.com/forums/en-US/… What u indeed could do is just let your workflow as it is and create an extra calculated column within SharePoint that rounds up your results which u can use for your word document, just as @lem.mallari suggests. – Dafalgor Apr 26 '13 at 6:06
    
Thanks much, it worked! – Daan Apr 26 '13 at 8:15

I faced this problem and to avoid calculated columns I used the basic provided arithmetic calc functions in workflow. For example, to get a file size in KB without a ton of decimals I did:

var FileSize = ItemFileSize + 512
var temp = FileSize % 1024
FileSize = FileSize - temp //(now I have filesize at the closest multiple of 1024)
FileSize = FileSize / 1024

Notice the trick to add 512 is to round to closest, instead of simply truncate

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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