Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to use IF function with AND, OR, and NOT in Excel?

In Excel, the IF function is quite useful to check whether a cell meets a condition and return different values based on evaluated results (True and False). And combining the IF function and AND, OR, NOT functions, it will vary conditions to check cells. Here I will introduce how to use IF and AND functions, IF and OR functions, and combine multiple IF functions in Excel.

How to use IF function in Excel

How to use If function and AND function in Excel

How to use IF function and OR function in Excel

How to combine multiple IF functions in one formula in Excel

Easily combine multiple worksheets/workbooks/CSV files into one worksheet/workbook

It may be tedious to combine dozens of sheets from different workbooks into one sheet. But with Kutools for Excel’s Combine (worksheets and workbooks) utility, you can get it done with just several clicks! Full Feature Free Trial 60-day!

ad combine sheets books 1


Supposing we have a sales table as the following screen shot shown, and now we want to evaluate the sale values and group them as "Unordinary", "Low", "Middle", and "High".

doc if and or not 1

And Now copy the row headers and column headers into a blank range (Range A16:E28 in our example) as the following screen shot shown.

doc if and or not 2

Excel Productivity Tools

Office Tab: Bring powerful tabs to Office (include Excel), just like Chrome, Safari, Firefox and Internet Explorer. Save you half the time, and reduce thousands of mouse clicks for you. 30-day Unlimited Free Trial

Kutools for Excel: Save 70% of your time and solve 80% Excel problems for you. 300+ advanced features designed for 1500+ work scenario, make Excel much easy and increase productivity immediately. 60-day Unlimited Free Trial


arrow blue right bubbleHow to use IF function in Excel

The basic form of IF function in Excel is shown as: =IF(logic_test, value_if true, value_if_false)

In our case we want to check the sale volumes are Low or not. If the value in Cell B2 is equal or less than 80, return the text of "Low", if the value in Cell B2 is bigger than 80, return blank.

Enter the formula =IF(B2<=80,"Low","") into the Cell B17, and then drag the Fill Handle to the Range B17:E28. See screen shot below:

doc if and or not 3


arrow blue right bubbleHow to use If function and AND function in Excel

If you want to check if a cell meets several conditions at the same time, you can combine the IF function and AND function in Excel.
The basic form of AND function in Excel is =AND(Logical 1, Logical 2, Logical 3, …, etc.)

Now in our case we want to check a sale volume is more than 80 and less than 160 simultaneously, if yes returns the text of "Middle", and if no returns blank.

Enter the formula =IF(AND(B2>80,B2<160),"Middle","") into Cell B17, and then drag the Fill Handle to the Range B17:E28. See screen shot below:

doc if and or not 4


arrow blue right bubbleHow to use IF function and OR function in Excel

If you want to check if a cell meets one of multiple conditions, you can combine the IF function and OR function in Excel.

The basic form of OR function in Excel is =OR(Logical 1, Logical 2, Logical 3, …, etc.)

In our example, we want to find out the unordinary sale volumes which are bigger than 180 or less than 20. If the sale volumes are unordinary, return the text of "Unordinary", if no return blank.

Enter the formula =IF(OR(B2>180,B2<20),"Unordinary","") into Cell B17, and then drag the Fill Handle to the Range B17:E28. See screen shot below:

doc if and or not 5


arrow blue right bubbleHow to combine multiple IF functions into one formula in Excel

In our example, if you want to evaluate all sale volumes with one formula, you can apply a complex IF function.

If the sale volume is equal or less than 20, return text of "Unordinary"; if the sale volume is equal or less than 80, return text of "Low"; if equal or less than 160, return text of "Middle", and if equal or less than 200, return text of "High".

Enter the formula =IF(B2<=20,"Unordinary",IF(B2<=80, "Low", IF(B2<=160, "Middle", IF(B2<=200, "High", "")))) into Cell B17, and then drag the Fill Handle to the Range B17:E28. See screen shot below:

doc if and or not 6

note ribbon Formula is too complicated to remember? Save the formula as an Auto Text entry for reusing with only one click in future!
Read more…     Free trial

Excel Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 70%, and Help You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for you.

  • Designed for 1500+ work scenarios, helps you solve 80% Excel problems.
  • Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  • Being used by 110,000 elites and 300+ well-known companies.

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Alice · 2 months ago
    8. To be a Bunk Leader, a staff member must have over 4 service years and have completed leadership training.
    In cell L2, enter a formula using the IF and AND functions, as well as structured references to determine if Adam Moriarty can be a bunk leader.
    a. The logical test in the IF function should determine if the staff member’s Service Years is greater than 4 AND the staff member’s Leadership Training status is “Yes”. Remember to use a structured reference to the Service Years and the Leadership Training columns.
    b. The function should return the text Yes if a staff member meets both of those criteria.
    c. The function should return the text No if a staff member meets none or only one of those criteria.
    • To post as a guest, your comment is unpublished.
      kellytte · 1 months ago
      Hi Alice,
      Supposing the number of service year is placed in Cell B2, the leadership training stats is placed in Cell C2, you can use this formula =IF(AND(B2>4,C2="Yes"),"Yes","No")
  • To post as a guest, your comment is unpublished.
    Nicolae · 3 months ago
    hello!
    I need your brilliant minds to resolve a problem:
    if a1=blank & b1=blank & c1=blank & d1=blank then result1
    if a1=blank & b1=blank & c1=blank & d1>0 then result2
    if a1=blank & b1=blank & c1>0 & d1>0 then result3
    if a1=blank & b1>0 & c1>0 & d1>0 then result4
    if a1>0 & b1>0 & c1>0 & d1>0 then result5
    Can you please help me with a formula?
    i've tried with if/and, if/or but it seams i can't get a result.

    Thanks in advance!
    • To post as a guest, your comment is unpublished.
      upsss · 2 months ago
      =IF(AND(ISBLANK(A1);ISBLANK(B1);ISBLANK(C1);ISBLANK(D1));1;IF(AND(ISBLANK(A1);ISBLANK(B1);ISBLANK(C1);D1>0);2;IF(AND(ISBLANK(A1);ISBLANK(B1);C1>0;D1>0);3;IF(AND(ISBLANK(A1);B1>0;C1>0;D1>0);4;5))))
  • To post as a guest, your comment is unpublished.
    Ahmed Mosih · 4 months ago
    Need some help with logic. I wanted to check the first cell for data if it has data then it will return that cell; if it doesn't have data then it will return a different cell. But if the second cell is blank then it should return a msg. Can you please help.
  • To post as a guest, your comment is unpublished.
    Kent Durbin · 6 months ago
    IF(D15>30,"Organic Soils",IF(AND(D15>25,D15<29.99),"Clayey Soil (fine)",IF(AND(D15>20,D15<24.99),"Loamy Soil (moderately fine)",IF(AND(D15>10,D15<19.99),"Loamy Soil (medium)",IF(AND(D15>5,D15<9.99),"Loamy Soil (moderately coarse)",IF(D15<4.99,"Sandy Soil (coarse)")))))) Can you find the error?
  • To post as a guest, your comment is unpublished.
    yourname · 6 months ago
    A,b,c,d,e,f,g,a,y