IF Function not working with subtraction

des378

New Member
Joined
Jun 11, 2024
Messages
12
Office Version
  1. 365
Platform
  1. MacOS
Not sure what I'm doing wrong here or if this is a glitch in Excel,

EX:
A1 = 50.50
A2 = 50.10
A3 = 0.40

A4 = ((A1)-(A2)-(A3))

FORMULA:
IF(A4=0,"Equal to Zero","Not Zero")

For some reason the function always returns "Not Zero" even though A4 equates to 0.

How do I fix this? Thanks in advance
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hi, it's a floating point rounding error. See here.

One way to resolve it is to apply some rounding. i.e.

Book2
A
150.5
250.1
30.4
40
5Equal to Zero
Sheet1
Cell Formulas
RangeFormula
A4A4=ROUND(A1-A2-A3,13)
A5A5=IF(A4=0,"Equal to Zero","Not Zero")
 
Upvote 0
Solution
Hi, it's a floating point rounding error. See here.

One way to resolve it is to apply some rounding. i.e.

Book2
A
150.5
250.1
30.4
40
5Equal to Zero
Sheet1
Cell Formulas
RangeFormula
A4A4=ROUND(A1-A2-A3,13)
A5A5=IF(A4=0,"Equal to Zero","Not Zero")
Thanks for this!

In my completed formula I use the CONCAT function as well with the IF function and solved it using the ROUND function to compare if the number is equal to 0.
 
Upvote 0
@des378
Given that the gist of the solution was to ROUND, and that was suggested by @FormR, I have moved the 'solution mark' to post #2
 
Upvote 0

Forum statistics

Threads
1,225,730
Messages
6,186,698
Members
453,369
Latest member
positivemind

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