Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • How to Sort by Color in Excel
  • Conditional Formatting Color Scales Examples in Excel
  • How To Insert and Customize Sparklines in Excel
  • Add Outline to Data in Excel
  • How to add Trendline to a chart in Excel

References

  • How to get relative row numbers in a range in Excel
  • Merge tables with VLOOKUP in Excel
  • Excel Advanced Lookup using Index and Match Functions
  • How to use Excel VLOOKUP Function
  • How to get last column number in range in Excel

Data Validations

  • Data validation must not exist in list
  • Excel Data validation must not contain
  • Excel Data validation number multiple 100
  • Excel Data validation exists in list
  • How To Create Drop-down List in Excel

If this AND that OR that in Excel

by

This tutorial shows how to calculate If this AND that OR that in Excel using the example below;

Formula

=IF(AND(A1="x",OR(B1="y",B1="z")),"x","")

Explanation

To test for various combinations of this AND that, or this OR that, you can use the IF function with the AND and OR functions. In the example shown, the formula in D6 is:

=IF(AND(B6="red",OR(C6="small",C6="medium")),"x","")

When an item is “red”, and either “small” or “medium”, the formula returns “x”. All other combinations return an empty string (“”).

How this formula works

In the example shown, we simply want to “mark” or “flag” rows where the color is “red” AND size is either “small” or “medium”. To return TRUE when items are red and small, we can use a logical statement constructed with the AND function:

AND(B6="red",C6="small")

To extend the statement to return TRUE when items are red and either small or medium, we can nest the OR function inside the AND function like this:

AND(B6="red",OR(C6="small",C6="medium"))

This snippet will return TRUE only if the value in B6 is “red” AND the value in C6 is either “small” or “medium”.  It is placed inside the IF function as the logical test. When the logical test returns TRUE, the IF function returns “x”. When the logical test returns FALSE, the IF function returns an empty string (“”).

Change the values returned by IF to suit your needs.

Post navigation

Previous Post:

COSH function: Description, Usage, Syntax, Examples and Explanation

Next Post:

Excel Data validation require unique number

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • OR function Examples in Excel
  • Extract multiple matches into separate rows in Excel
  • OR function: Description, Usage, Syntax, Examples and Explanation
  • IFNA function: Description, Usage, Syntax, Examples and Explanation
  • SWITCH function: Description, Usage, Syntax, Examples and Explanation

Date Time

  • Calculate retirement date in Excel
  • NOW function: Description, Usage, Syntax, Examples and Explanation
  • How to get Weekdays, Working days between Two Dates in Excel
  • Display the current date in Excel
  • HOUR function: Description, Usage, Syntax, Examples and Explanation

Grouping

  • Group times into unequal buckets in Excel
  • Categorize text with keywords in Excel
  • If cell contains one of many things in Excel
  • Running count group by n size in Excel
  • How to randomly assign data to groups in Excel

General

  • Cell References: Relative, Absolute and Mixed Referencing Examples
  • Subtotal by invoice number in Excel
  • How to get random value from list or table in Excel
  • Print Excel Sheet In Landscape Or Portrait
  • Excel Default Templates
© 2026 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning