# Error in few subtraction formulas

#### praveenjain64

##### New Member
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

### Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

#### shg

##### MrExcel MVP
May we know the formula you are using?

#### praveenjain64

##### New Member
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.

Thank you

##### MrExcel MVP
Try truncing once instead of twice to see if that helps:

=TRUNC(D2-E2,2)

#### praveenjain64

##### New Member
Great.... It works

Replies
2
Views
64
Replies
4
Views
58
Replies
3
Views
105
Replies
3
Views
328
Replies
0
Views
51

1,127,832
Messages
5,627,152
Members
416,224
Latest member
RichardHell

### 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.

### Which adblocker are you using?

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

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