Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
GEM GEM is offline
external usenet poster
 
Posts: 90
Default Rounding Numbers.

How can I round a number to two decimals. Not using the increase/decrease
decimals. For example...

I get an answer like this, 2.41666666666667, I know that if you lower the
decimals to two units, the cell will show the answer 2.42, but if I use this
cell in a calculation it will still use 2.41666666666667, and will give me an
incorrect answer.

100 * 2.41666666666667 = 241.6666667
100 * 2.42 = 242


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Rounding Numbers.

In B1: =100*ROUND(A1,2)
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:16,400 Files:356 Subscribers:53
xdemechanik
---
"GEM" wrote:
How can I round a number to two decimals. Not using the increase/decrease
decimals. For example...

I get an answer like this, 2.41666666666667, I know that if you lower the
decimals to two units, the cell will show the answer 2.42, but if I use this
cell in a calculation it will still use 2.41666666666667, and will give me an
incorrect answer.

100 * 2.41666666666667 = 241.6666667
100 * 2.42 = 242


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default Rounding Numbers.

On Jul 31, 7:12*pm, Max wrote:
In B1: =100*ROUND(A1,2)


Although that is sufficient for the OP's example, it is not always the
case. So in general, I would do ROUND(100*ROUND(A1,2),0) if the
intention is get exactly the same internal representation as we would
get if we entered the integral constant.

Consider the case where A1 is the constant 2.00666666666667.
100*ROUND(A1,2) in B1 seems to result in 201; in fact, (B1 = 201)
results in TRUE. But (B1-200 = 1) results in FALSE.

Of course, the reason is that although ROUND(A1,2) has the same
internal representation as the constant 2.01, 2.01 cannot be
represented exactly in IEEE floating-point[*]. So when we multiply
by 100, we do not get exactly 201. Then when we subtract 200, the
difference between the result and 1 is large enough that Excel does
not consider them equal.
[*] In contrast, in the OP's example, although 2.42 also cannot be
represented exactly internally, 100*ROUND(A1,2) does result in exactly
the same internal representation as the constant 242.


----- original posting -----

On Jul 31, 7:12 pm, Max wrote:
In B1: =100*ROUND(A1,2)
--
Max
Singaporehttp://savefile.com/projects/236895
Downloads:16,400 Files:356 Subscribers:53
xdemechanik
---



"GEM" wrote:
How can I round a number to two decimals. Not using the increase/decrease
decimals. For example...


I get an answer like this, 2.41666666666667, I know that if you lower the
decimals to two units, the cell will show the answer 2.42, but if I use this
cell in a calculation it will still use 2.41666666666667, and will give me an
incorrect answer.


100 * 2.41666666666667 = 241.6666667
100 * 2.42 = 242- Hide quoted text -


- Show quoted text -


Reply
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
Rounding numbers up or down boyshanks Excel Discussion (Misc queries) 13 April 8th 09 03:03 PM
rounding numbers in XL Sean Lambertz Excel Discussion (Misc queries) 4 May 30th 06 10:32 PM
Rounding numbers Phil Excel Discussion (Misc queries) 3 March 8th 06 09:35 PM
Rounding up numbers Michelle Nichols via OfficeKB.com Excel Discussion (Misc queries) 2 April 28th 05 05:03 PM
Rounding Numbers j41cam Excel Discussion (Misc queries) 1 April 18th 05 07:47 PM


All times are GMT +1. The time now is 10:55 AM.

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"