Thursday, July 19, 2018

#1 2012-06-11 06:32:34 am

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

excel currency values missing decimal place

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


Filed under: excel, Automator, workflow, cell

Offline

 

#2 2012-06-11 06:58:25 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11499
Website

Re: excel currency values missing decimal place

Hi,

try string value instead of value


regards

Stefan

Offline

 

#3 2012-06-13 04:20:39 am

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

Re: excel currency values missing decimal place

Brilliant - Thanks Stefan!


--
“In theory, theory and practice are the same. In practice, they are not.”
― Albert Einstein

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)