Monday, January 22, 2018

You are not logged in.

**orionrush****Member**- Registered: 2008-10-05
- Posts: 31

Hello,

Im trying to pull a currency value from an excel cell and for whatever reason, the variable will drop the trailing zero from the cents decimal place ie.

1.20 becomes 1.2

.

While the cell is already formatted as "currency" in excel, is there anything I could be doing on the excel side to to force the trailing zero in these instances?

I did find some discussion of a class that will round and add the trailing zero, but I suspect that excel is already doing the rounding. Besides Im not sure how I'd incorporate this class into what I've already got -- any help would be greatly appreciated.

Many thanks in advance for you experience here.

## Applescript:

on run {input, parameters}

tell application "Microsoft Excel"

copy value of cell "F24" to input

end tell

return input

end run

--http://lists.apple.com/archives/applescript-users/2006/Jun/msg00202.html

--on roundThis(n, numDecimals)

--set x to 10 ^ numDecimals

--tell (n * x) as string as number to return (it div 0.5 - it div 1) / x

--end roundThis

--

â€œIn theory, theory and practice are the same. In practice, they are not.â€

â€• Albert Einstein

Offline

**orionrush****Member**- Registered: 2008-10-05
- Posts: 31

Brilliant - Thanks Stefan!

--

â€œIn theory, theory and practice are the same. In practice, they are not.â€

â€• Albert Einstein

Offline