Error in few subtraction formulas

praveenjain64

New Member
Joined
Feb 7, 2014
Messages
7
Hi,

I tried a lot of ways to fix this by TRUNC & ROUND to restrict this happening, but I am not successful.

I am using a nested formula which has a small subtraction within it.

There are few cases when the subtraction is does not works if thought I have the subtraction within TRUNC.

E.g.: 5.36 - 4.6

The simple subtraction always shows as 0.76 where as when I have nested this calculation with a TRUNC in the formula is shows the result as 0.760000000000001

I tested the formula in edit mode by pressing F9 key & the result is 0.760000000000001.

Could someone help me with this please?

-Praveen
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,783
Office Version
  1. 2010
Platform
  1. Windows
May we know the formula you are using?
 

praveenjain64

New Member
Joined
Feb 7, 2014
Messages
7
Hi,

The formula is linked to 4 cells & below is the formula:

=IFERROR(IF(LEFT(C2,1)="*",CONCATENATE(C2," ",B2," ",E2),IF(ISERROR(LEN(MID(D2,SEARCH(".",D2)+1,2)))=TRUE,CONCATENATE(C2," ",UPPER(B2)," ",TRUNC(D2,2),">",TRUNC(E2,2),IF((D2-E2)/D2<=0%," ERROR",IF((D2-E2)/D2=50%," HP",IF((D2-E2)/D2<50%,CONCATENATE(" SV ",TRUNC(D2,2)-TRUNC(E2,2)),IF((D2-E2)/D2>50%," BTHP"))))),IF(LEN(MID(D2,SEARCH(".",D2)+1,2))=2,CONCATENATE(C2," ",UPPER(B2)," ",TRUNC(D2,2),">",TRUNC(E2,2),IF((D2-E2)/D2<=0%," ERROR",IF((D2-E2)/D2=50%," HP",IF(((D2-0.01)-E2)/(D2-0.01)=50%," HP",IF((D2-E2)/D2<50%,CONCATENATE(" SV ",TRUNC(D2,2)-TRUNC(E2,2)),IF(((D2-0.01)-E2)/(D2-0.01)<50%,CONCATENATE(" SV ",TRUNC(D2,2)-TRUNC(E2,2)),IF((D2-E2)/D2>50%," BTHP",IF(((D2-0.01)-E2)/(D2-0.01)>50%," BTHP")))))))),IF(LEN(MID(D2,SEARCH(".",D2)+1,2))=1,CONCATENATE(C2," ",UPPER(B2)," ",TRUNC(D2,2),">",TRUNC(E2,2),IF((D2-E2)/D2<=0%," ERROR",IF((D2-E2)/D2=50%," HP",IF((D2-E2)/D2<50%,CONCATENATE(" SV ",TRUNC(D2,2)-TRUNC(E2,2)),IF((D2-E2)/D2>50%," BTHP"))))))))),"")


In the above formula I have a text in B & C and number (price) in D & E.

I am using a TRUNC because any thing greater than .005 should be rounded down to the below number.

Please let me know if you need any more information.

Thank you :)
 

Watch MrExcel Video

Forum statistics

Threads
1,128,167
Messages
5,629,079
Members
416,364
Latest member
maatpsr

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
Top