• Kalpesh Agrawal

VBA If Elseif Else with AND Operator

We have used the If, Elseif, and Else statement in the last example.

You might be thinking that what is the necessity of AND operator.

The answer is, sometimes when you are working on thousands of data you must have some incorrect values so to overcome it you can add AND operator in our code.

Like, if you have the value -2 in cell A2, you will get the answer “No Eye problem” but this is wrong as the value is incorrect.

Also if I have the value XYZ in cell A2, I get the answer “Major Eye problem”. (You can check on your own). These are wrong values but I got the general answer which leads to misunderstanding in decision making.

You can use the data given below…

Let’s see how to solve this problem…


Related Posts

See All