If This AND/OR That (A Quick Excel Tip)

We’ve already discussed the use of IF function in Microsoft Excel. Today we will dive a little bit deeper.

AND Function in EXCEL!

What If we want to check if more than one conditions are TRUE? In this case, we will use AND function.

Best way to describe the way AND works is to show you a little Example.

Testing different Cells

In this Example, we will test if we have Circular shape and Size smaller or equal to 20. If we do, we need “X” symbol for Usage, if we don’t we will display “-“.

As we are already familiar with the IF Syntax –
=IF (logical_test, [value_if_true], [value_if_false]). we won’t explain it again.
This time for Logical Test we will be an AND Function. The syntax for And Functions is:
=AND([logical 1],[logical 2], ..) 
Note: We can use more than two logical tests!

In our example AND Syntax will look like this:
A2=”circle”,B2<=20

And the whole test is:
=IF(AND(A2=”circle”,B2<=20),”X”,”-“)

Test a single Cell

We can use AND function to test a single cell. For example, If the quantity of items is between 100 and 150 we will store them.
In this case, the whole Formula will look like this:
=IF(AND(B2>100,B2<150),”Store”,”-“)
Where AND(B2>100, B2<150), is the syntax for AND Function.

Using OR function in Excel!

As useful as AND is there is an equally useful function, namely OR.
The main difference is that while by using AND, TRUE result will be given when All the logical tests are TRUE. Using OR requires only one of the tests to be TRUE in order to return value_if_true.

To better illustrate that we will use OR with our previous examples.

Testing different Cells

This time we want to get “X” every time the Shape is Circle or the size is smaller than 20.

The syntax for OR Functions is:
=OR([logical 1],[logical 2], ..) 
Note: We can use more than two logical tests!

The whole test is:
=IF(OR(A2=”circle”,B2<=20),”X”,”-“)

Testing a Single Cell

In this example, we will Store the items that are more than 150 or less than 100. So the formula will be:
=IF(OR(B2>150, B2<100),”Store”,”-“)

We hope you like the content and find it useful! Stay tuned for more also Share it with your Colleagues and Friends!

 

 

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply

.wp-container-core-social-links-is-layout-1.wp-container-core-social-links-is-layout-1{flex-wrap:nowrap;justify-content:flex-start}.wp-container-core-social-links-is-layout-2.wp-container-core-social-links-is-layout-2{flex-wrap:nowrap;justify-content:flex-start}