ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Help - cannot compare values properly even though they display same thing! (https://www.excelbanter.com/excel-discussion-misc-queries/155129-help-cannot-compare-values-properly-even-though-they-display-same-thing.html)

Tommy[_4_]

Help - cannot compare values properly even though they display same thing!
 
I have a simple IF statement that compares the values of two cells:
=IF(D5=G5,"Good","Bad"). Simple enough. The problem is that even when
the value of the cell is exactly the same i.e both D5 and G5 show
"WT_STEDY", it is still returning "Bad". I did a little bit of error
checking: trimmed both cells to ensure no rogue spaces were there etc.
The difference lies in the formula bar. For cell G5, the bar
shows:"WT_STEDY" whereas for cell D5 it shows "=PISampDat($D$1,$B$5,$B
$748,"1h", 0)" which is call from a database. How do I change my
original IF statement to compare the actual strings output / displayed
in the two cells?? I don't mind using some VB, but I'd rather not
because the problem seems so trivial.

Regards,

Tom


Bob Umlas

Help - cannot compare values properly even though they display same thing!
 
You shouldn't need to do anything special -- Excel's IF statement DOES
compare the value, not the formula. Click in the formulabar for D5 & press
F9 -- does it still say WT_STEDY? Do you have calculation set to automatic?
Bob Umlas
Excel MVP
"Tommy" wrote in message
ups.com...
I have a simple IF statement that compares the values of two cells:
=IF(D5=G5,"Good","Bad"). Simple enough. The problem is that even when
the value of the cell is exactly the same i.e both D5 and G5 show
"WT_STEDY", it is still returning "Bad". I did a little bit of error
checking: trimmed both cells to ensure no rogue spaces were there etc.
The difference lies in the formula bar. For cell G5, the bar
shows:"WT_STEDY" whereas for cell D5 it shows "=PISampDat($D$1,$B$5,$B
$748,"1h", 0)" which is call from a database. How do I change my
original IF statement to compare the actual strings output / displayed
in the two cells?? I don't mind using some VB, but I'd rather not
because the problem seems so trivial.

Regards,

Tom




Duke Carey

Help - cannot compare values properly even though they display sam
 
Select the cell with the =PISampDat($D$1,$B$5,$B$748,"1h", 0) formula
Press the F2 key, then the F9 key. Does the result EXACTLY match your
WT_STEDY string, or is there a leading/trailing space(s)

"Tommy" wrote:

I have a simple IF statement that compares the values of two cells:
=IF(D5=G5,"Good","Bad"). Simple enough. The problem is that even when
the value of the cell is exactly the same i.e both D5 and G5 show
"WT_STEDY", it is still returning "Bad". I did a little bit of error
checking: trimmed both cells to ensure no rogue spaces were there etc.
The difference lies in the formula bar. For cell G5, the bar
shows:"WT_STEDY" whereas for cell D5 it shows "=PISampDat($D$1,$B$5,$B
$748,"1h", 0)" which is call from a database. How do I change my
original IF statement to compare the actual strings output / displayed
in the two cells?? I don't mind using some VB, but I'd rather not
because the problem seems so trivial.

Regards,

Tom




All times are GMT +1. The time now is 02:00 PM.

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