Skip to main content

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.

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


How 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

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!


ad combine sheets books 1

How 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:


How 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:


How 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:

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

Best Office Productivity Tools

Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

kte tab 201905


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (72)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hey Friends,

Donno if this Forum works now:

I am trying to figure out a formula for the following:
I have 3 Columns : viz : A1,D1, L1 with text contents. And output expected in M1

So if any of the cells A,D,L has Faulty mentioned, then M1 should result "Faulty", Else if all 3 are blank , need "Spare", and if any cell has any data then it shoud show "Mapped"
This comment was minimized by the moderator on the site
Kan iemand mij helpen met onderstaande voor het maken van een formule?
als B2 de tekst factuur staat moet in cel D8 de tekst factuurdatum komen te staan. Als in cel B2 de tekst offerte staat moet in cel D8 offertedatum komen te staan.

Alvast hartelijk dank
This comment was minimized by the moderator on the site
Hi there,

Can you show us the look of the text invoice, text quotation and text quotation date?
This comment was minimized by the moderator on the site
I am trying to write a formula to populate scores based off a range of values. This is what I have so far:

=IF(C2>=104.5%,"5", IF(C2<=104.49%,"4", IF(C2>=95.5%,"4", IF(C2<=95.49%,"3", IF(C2>=79.5%,"3", IF(C2<=79.49%,"2", IF(C2>=59.5%,"2", IF(C2<=59.49%,"1"""))))))))

The formula is working and I am not receiving any error messages. However, it is not populating the lower range values correctly. Here is my range:

>105% = 5
96%-105% = 4
80%-95% = 3
60%-79% = 2
<60% = 1

Any help is greatly appreciated.
This comment was minimized by the moderator on the site
Hi there,

I've fixed the formula as shown below:
=IF(C2>105%,"5",IF(C2>=96%,"4",IF(C2>=80%,"3",IF(C2>=60%,"2","1"))))

Hope this is what you want.

Amanda
This comment was minimized by the moderator on the site
Never mind, I figured it out. Thanks!
This comment was minimized by the moderator on the site
Kan iemand mij helpen aan onderstaande formule?
Alvast bedankt!

als Q groter is dan C dan Q en als Q kleiner is dan H dan H tenzij H 0 is dan is Q
This comment was minimized by the moderator on the site
Hi there,

Suppose, Q=A1, C=A2, H=A3. Please use the formula below: =IF(B1>B2,B1,IF(B1<B3,IF(B3=0,B1,B3),B3))

Hope this is what you want.

Amanda
This comment was minimized by the moderator on the site
I am trying to find a formula when realignment is in column A then add the text conflict when transition begins date (B) is >= the solution start date in column D OR if activation in column A then add the text conflict when transition begins date is <= solution start date in column D OR if deactivation then add the text conflict when transition begins date is >= the solution start date
A B C D E
Transition Type Transition Begins Transition Ends Solution Start Date Solution End Date
Realignment 11/1/2022 11/15/2022 1/15/2022 3/6/2022
Realignment 11/1/2022 11/15/2022 1/15/2022 3/16/2022
Realignment 11/1/2022 11/15/2022 6/1/2022 7/16/2022
Realignment 11/1/2022 11/15/2022 6/1/2022 7/16/2022
Realignment 11/1/2022 11/15/2022 6/1/2022 7/16/2022
Activation 1/1/2022 1/31/2022 1/15/2022 3/6/2022
Deactivation 12/1/2021 12/15/2021 1/15/2022 3/6/2022
Reorganization 2/6/2022 2/12/2022 1/15/2022 3/6/2022
Activation 12/1/2021 12/31/2021 11/1/2029 12/31/2029
Activation 12/1/2021 12/31/2021 2/1/2025 7/31/2025
Activation 12/1/2021 12/31/2021 4/1/2024 6/29/2024
Activation 12/1/2021 12/31/2021 2/1/2028 3/2/2028
Activation 12/1/2021 12/31/2021 2/1/2022 5/20/2025
Activation 12/1/2021 12/31/2021 9/6/2022 3/16/2023
Activation 12/1/2021 12/31/2021 6/1/2024 11/28/2024
Activation 12/1/2021 12/31/2021 9/1/2022 9/7/2022
Deactivation 10/1/2021 10/30/2021 11/1/2029 12/31/2029
Deactivation 10/1/2021 10/30/2021 2/1/2025 7/31/2025
Deactivation 10/1/2021 10/30/2021 4/1/2024 6/29/2024
Deactivation 10/1/2021 10/30/2021 2/1/2028 3/2/2028
Deactivation 10/1/2021 10/30/2021 2/1/2022 5/20/2025
Deactivation 10/1/2021 10/30/2021 9/6/2022 3/16/2023
Deactivation 10/1/2021 10/30/2021 6/1/2024 11/28/2024
Deactivation 10/1/2021 10/30/2021 9/1/2022 9/7/2022
Reorganization 2/1/2022 2/28/2022 11/1/2029 12/31/2029
Reorganization 2/1/2022 2/28/2022 2/1/2025 7/31/2025
This comment was minimized by the moderator on the site
Hi there,

What do you mean by adding the text conflict? Can you show me the result you want?

Amanda
This comment was minimized by the moderator on the site
=IF(AND(AY7>60,AY7>30),"0.02","0.04"),if(and(ay7<=30,ay<az),"0.06"),if(and(ay7<=15,ay<az),"0.08")
This comment was minimized by the moderator on the site
I am trying use If formula for one oridinary file, lets say I have number from 1 to 31 in a perticular cell. I need to show the result in another cell as if number in that perticular cell is less than 26 they it will zero, if the number in that perticular cell is from 26 to 30 then it will show the same number but if the number is abobe 30 then it will show the 30 only....Can anyone advise me how can I formulate this formula?
This comment was minimized by the moderator on the site
Hi there,

Please try the formula below: =IF(A1<26,0,IF(A1<=30,A1,30))

Hope this could help you.

Amanda
This comment was minimized by the moderator on the site
Ciao,
mi potete aiutare perfavore...
ho tre celle:
1-data di pagamento
2-totale
3-totale se pagato

vorrei che quando inserisco la data di pagamento(1), la casella 3(che è vuota) si riempisse automaticamente come la casella 2
come posso fare?
This comment was minimized by the moderator on the site
Hi there,

Do you want to fill the value of the cell 2 in the cell 3?
If so, you can enter this IF formula in the casella 3: =IF(casella 1<>"",casella 2,"")

Amanda
This comment was minimized by the moderator on the site
=IF(D4<=30000, and =>20000,than D4a-5000,and if(d4<=40000, and >30000, than d4-6000) convert into formula
This comment was minimized by the moderator on the site
Try the formula. Since I don't quite understand you, please check and change the part "DA4-5000" and "D4-6000", "FALSE" to the results you want.
=IF(AND(D4<=30000,D4>20000),"DA4-5000",IF(AND(D4<=40000,D4>30000),"D4-6000","FALSE"))
Amanda
This comment was minimized by the moderator on the site
HI EVERY ONE I NEED HELP IN THIS SYNTEX=IF(AND(AJ=1250,AJ*2.5%),IF(AND(AJ>1250,AJ<=2500),AJ*10%,IF(AND(AJ>2500,AJ<=3750),AJ*15%,IF(AND(AJ>3750,AJ<=11666),AJ*20%))))
THIS FOURMAIL GIVE ME #NAME WHERE THE EROO
This comment was minimized by the moderator on the site
Hi ahmed.dba,
Can you send the file to ? And if you have private information in the file, please delete them.
Amanda
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations