# Excel 2007 : Conditional logic issue

1. ## Conditional logic issue

I am trying to assign values based on the following scenario:
If the value of a cell is >= "D24", then x. If false, then y. D24 is the value, not a reference to a particular cell. The formula I am using is:
=IF(L3>="D24", "X","Y")
Formula works fine for values D1 and D2, but D3-D9 return "X" instead of "Y". Values above D24 work fine. Suggestions?  Register To Reply

2. ## Re: Conditional logic issue

Since D24 is a text: How do you want to compare it with something?

If it's a cell remo " " around it.  Register To Reply

3. ## Re: Conditional logic issue

Are the values always starting with "D"?

If so, then you can compare just the numeric portions.

e.g.

=IF(MID(L3,2,10)+0>=MID("D24",2,10)+0, "X","Y")  Register To Reply

4. ## Re: Conditional logic issue Originally Posted by zbor Since D24 is a text: How do you want to compare it with something?

If it's a cell remo " " around it.
I've tried it as a number, as general, as text. results same in every instance.  Register To Reply

5. ## Re: Conditional logic issue  Register To Reply

6. ## Re: Conditional logic issue Originally Posted by NBVC Are the values always starting with "D"?

If so, then you can compare just the numeric portions.

e.g.

=IF(MID(L3,2,10)+0>=MID("D24",2,10)+0, "X","Y")
THANK YOU!!!
Used the following:
=IF(MID(L3,2,2)+0>24, "X","Y"
Worked great!  Register To Reply

7. ## Re: Conditional logic issue

Yes, if you know it is 24 always, that is better... my sample was more for showing that you can also replace D24 with another cell reference that may change....  Register To Reply