LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Test for fractions of a penny

That's what this code does..

i = CLng(CDbl(.Value) * 100)
d = CDbl(.Value) * 100
If Abs(d - i) 0 Then
' Entered value has a fraction of a cent

Try 282.47
if I add MsgBox i & " " & d & " " & .Value & " " & Abs(d - i) just
after the d = line above

the results are
28247 28247 282.47 3.6379788709171E-12

so basically Double(282.47 * 100) - Long(282.47 * 100) != 0

Not sure how to get around thing correctly..

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calc sometimes off by a penny Access Joe Excel Worksheet Functions 6 April 29th 23 03:43 AM
Exel 2007 penny off scarter Excel Discussion (Misc queries) 4 April 10th 08 01:43 AM
AutoSum lost a penny PoldenKaz Excel Worksheet Functions 5 September 28th 07 01:30 PM
My accounting program is a penny off, Why? bigelwood Excel Worksheet Functions 2 April 23rd 07 01:46 AM
In Excel the total is off by a penny. jules Excel Worksheet Functions 1 June 17th 05 03:43 AM


All times are GMT +1. The time now is 02:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"