Post

2 followers Follow
0
Avatar

How convert currency value to number?

I want round some calculated value and i have problem with conversation currency to number. How to do it?

 

This is an example of formula which i build:

Round(ToNumber(ToString($TimeTrackingCost-($TotalEstimatedCost*$PercentCompleted/100))),1)

Now i get following error:

{Round(ToNumber(ToString($TotalEstimatedCost*$PercentCompleted/100)),1)}: Argument 'value' to function 'ToNumber' has value '19428.5714285792 PLN' which is not convertible to numeric

 

Krzysztof Brud Answered

Please sign in to leave a comment.

3 comments

0
Avatar

Hi Krzysztof,

That is a great question! This is more of a customization question so I went ahead and moved this question to our Customization section of the forum. 

Tom Do 0 votes
Comment actions Permalink
0
Avatar

Hi Krzysztof,

Cost fields are currency fields. If you want to perform Round function on them you need to convert them into their numeric value. The trick is to use VALUE/currency(1). In that case, it should look something like this: Round(($TimeTrackingCost-($TotalEstimatedCost*$PercentCompleted/100))/Currency(1),1)

If you want to convert is back to a currency field do the opposite or apply Currency function on the result: Currency(result)

Please let me know if it is working as expected.

 

Regards and happy holidays!

Tamir

Tamir Avital 0 votes
Comment actions Permalink
0
Avatar

I found this old post, but had trouble implementing, so I thought I'd post my workaround: it appears that currency values (if populated) can easily be manipulated as strings: they contain a number, then a space, then a three-letter currency code.  So, you can extract the number portion with:

ToNumber(Catch(Left(ToString($C_SomeCost),Len(ToString($C_SomeCost))-4),'0'))

It...
1. Converts currency field to string
2. Pull all but the right-most 4 characters from the string (getting rid of '_USD', or other currency codes)
3. Wraps in a Catch function that returns zero, just in case the currency field is empty (which would otherwise cause an error).

Todd Tetreault 0 votes
Comment actions Permalink