ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Comparing using "If" function (https://www.excelbanter.com/excel-programming/361893-comparing-using-if-function.html)

F. Lawrence Kulchar

Comparing using "If" function
 
When I input =if(ab5=ab6,"yes","no")

I continually get a "no" because ab5 = 10.00001

and ab6 = 10.00002

Although I have both cells formatted for 0 (zero) decimal places, i.e. they
both show a "10" in the spreadsheet, I wish this comparison to show a "yes"
in its application. Various arithmetic progressions led to the decimal
descrepancy.

How do I correct my "if" comparison to show a "yes" given the above example??

Thanks,

FLKulchar

Mark

Comparing using "If" function
 
Hi.

Pick some number of decimal places to round to, and then compare the rounded
values.

=if(round(ab5,5)=round(ab6,5),"yes","no")

Alternatively, you could subtract one from the other and check the abs() of
the result to see that it was less than some small number you picked..

=if(abs(ab5-ab6)<.00001,"yes","no")




"F. Lawrence Kulchar" wrote:

When I input =if(ab5=ab6,"yes","no")

I continually get a "no" because ab5 = 10.00001

and ab6 = 10.00002

Although I have both cells formatted for 0 (zero) decimal places, i.e. they
both show a "10" in the spreadsheet, I wish this comparison to show a "yes"
in its application. Various arithmetic progressions led to the decimal
descrepancy.

How do I correct my "if" comparison to show a "yes" given the above example??

Thanks,

FLKulchar


Nigel RS[_2_]

Comparing using "If" function
 
If you are using Integers only try this alternative....

=IF(INT(AB5)=INT(AB6),"Yes","No")

Cheers
Nigel

"mark" wrote:

Hi.

Pick some number of decimal places to round to, and then compare the rounded
values.

=if(round(ab5,5)=round(ab6,5),"yes","no")

Alternatively, you could subtract one from the other and check the abs() of
the result to see that it was less than some small number you picked..

=if(abs(ab5-ab6)<.00001,"yes","no")




"F. Lawrence Kulchar" wrote:

When I input =if(ab5=ab6,"yes","no")

I continually get a "no" because ab5 = 10.00001

and ab6 = 10.00002

Although I have both cells formatted for 0 (zero) decimal places, i.e. they
both show a "10" in the spreadsheet, I wish this comparison to show a "yes"
in its application. Various arithmetic progressions led to the decimal
descrepancy.

How do I correct my "if" comparison to show a "yes" given the above example??

Thanks,

FLKulchar



All times are GMT +1. The time now is 05:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com