A very simple minus calculation based on same values but show difference?

agasi

New Member
Joined
Nov 22, 2016
Messages
48
When I compare a,b I get "True". But when I subtract a-b although it shows 0.00 if I increase decimals, it is not 0.00. Does anyone know why it shows the difference?​



a: 145.454545454545000000000000

b: 145.454545454545000000000000

Result: -0.000000000000426325641456

<tbody>
</tbody><colgroup><col></colgroup>

<tbody>
</tbody><colgroup><col></colgroup>

<tbody>
</tbody><colgroup><col></colgroup>
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Are the values in A and B derived from formulae? If so, do you have the ROUND function applied?
 
Upvote 0
What are the formulae? And what are the values used in the formulae? Are any of those rounded?
 
Upvote 0
When I compare a,b I get "True". But when I subtract a-b although it shows 0.00 if I increase decimals, it is not 0.00. Does anyone know why it shows the difference?​



a: 145.454545454545000000000000

b: 145.454545454545000000000000

Result: -0.000000000000426325641456

<tbody>
</tbody>

<tbody>
</tbody>

<tbody>
</tbody>
In simple terms, this is the result of conversion of computer-readable binary numbers into human-readable decimals.
 
Upvote 0
a: sum of the below (all hardcoded)
0.00000000000
29.54545454545
0.00000000000
115.90909090909
0.00000000000




b: (sum of A/325)*325

sum of A /
325.0000000000000000 * 325.0000000000000000

<tbody>
</tbody><colgroup><col></colgroup>




<tbody>
</tbody><colgroup><col></colgroup>
 
Upvote 0
Tetra, thanks. But is there any other way apart from using Round? It should be zero to match the look up criteria (zero).
 
Upvote 0
There might be, but using ROUND(...,n) is the easiest way. You should always use it when comparing non-hardcoded floating-point numbers.
 
Upvote 0

Forum statistics

Threads
1,214,601
Messages
6,120,465
Members
448,965
Latest member
grijken

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top