ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   IF Statement return wrong comparison (https://www.excelbanter.com/excel-worksheet-functions/450916-if-statement-return-wrong-comparison.html)

Don B[_2_]

IF Statement return wrong comparison
 
I have a If statement in L95 as follows: IF(L95="District Did Not Investigate" and L95 contains this statement It returns a FALSE answer when the answer should be TRUE. WHY?

Howard Silcock

IF Statement return wrong comparison
 
On Wednesday, 3 June 2015 23:40:42 UTC+10, Don B wrote:
I have a If statement in L95 as follows: IF(L95="District Did Not Investigate" and L95 contains this statement It returns a FALSE answer when the answer should be TRUE. WHY?


Most likely there's an extra space in the text in L95 or a change of case somewhere. One way to get around this would be to change your formula to start
=IF(TRIM(UPPER(L95))="DISTRICT DID NOT INVESTIGATE" ...

That should give the right result whether or not there are extra spaces around the text or the case is incorrect.

Howard


All times are GMT +1. The time now is 03:51 AM.

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