Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
Can someone tell me how to do a if loop in Excel to retrieve info for condition like,
if (a&b)=1, then show true....something like this but its using the and/or condition in the loop; I searched but I wasn't clear, can someone please help me.thanks
Sappy

You need to be more specific. You can do nested ifs. Please provide an example of what you want to query and the results you want.

hi jenifer,
Ok here is what I want, hopefully this is more clear......Comparing numbers in cells and returning 'True' if all the arguments are true, or else return false if any of the arguments are not true.so for example..
if (X>Y and X<Z, True, False)
so I am asking the software to say if 'X' is greater then 'Y' and 'X' is less then 'Z' return 'True' else return 'False' in this case 'X,Y,Z' can be numbers in the cells of the worksheet. I am not sure how to incorporate this formula into Excel?
thanks much,
sappy

You might be looking for Do While(Until) conditions are met. Such as Do While a=1 and b=2.
Do [{While | Until} condition]
[statements]
[Exit Do]
[statements]Loop
Look here for more info:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/office97/html/output/F1/D6/S5B1DB.asp

if (X>Y and X<Z, True, False)
Replacing A1 for X, B1 for Y, and C1 for Z the formula would be like this:
=if(A1>B1,if(A1<C1,"True","False"),"False")
Michael J

Hi Michael,
Just a thought, can't excel recognize the use of 'If statements with 'and/or' conditions, do we always need to rewrite them. I think it would make life much easier that way.
thanks much for your help.
sapps
Sappy

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |