ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   problem with IF statement (https://www.excelbanter.com/excel-discussion-misc-queries/106254-problem-if-statement.html)

wolfpack95

problem with IF statement
 

I am comparing two columns with a IF statement and returning "Yes" if
they're equal and "No" if they're not. However, I'm getting a "No" in
cases where the values are equal. The formula works correctly if I
select each cell and press enter. However, my sheet is too long to do
this for every cell.

I believe this is due to concatenating/comparing two text columns and I
have seen this issue before but I can't remember the remedy. Thanks for
any help.


--
wolfpack95
------------------------------------------------------------------------
wolfpack95's Profile: http://www.excelforum.com/member.php...info&userid=93
View this thread: http://www.excelforum.com/showthread...hreadid=573881


Sandy Mann

problem with IF statement
 
wolfpack95,

The most likely reason for comparisons failing is that the values only look
the same but are very slightly different. For example if one cell has =1/9
and the other a constant of 0.111111 they will both look the same in the
cell but a test of =A1=A2 will return FALSE because 1/9 is 0.111 recurring.
The answer is to round the data before comparing it as in:

=ROUND(A1,6)=ROUND(A2,6)

--
HTH

Sandy
In Perth, the ancient capital of Scotland


with @tiscali.co.uk


"wolfpack95" wrote
in message ...

I am comparing two columns with a IF statement and returning "Yes" if
they're equal and "No" if they're not. However, I'm getting a "No" in
cases where the values are equal. The formula works correctly if I
select each cell and press enter. However, my sheet is too long to do
this for every cell.

I believe this is due to concatenating/comparing two text columns and I
have seen this issue before but I can't remember the remedy. Thanks for
any help.


--
wolfpack95
------------------------------------------------------------------------
wolfpack95's Profile:
http://www.excelforum.com/member.php...info&userid=93
View this thread: http://www.excelforum.com/showthread...hreadid=573881





All times are GMT +1. The time now is 08:58 AM.

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