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
  • Understanding Pivot Tables in Excel
  • Conflicting Multiple Conditional Formatting Rules in Excel
  • How to do a t-Test in Excel?
  • Example of COUNTIFS with variable table column in Excel

References

  • INDEX function: Description, Usage, Syntax, Examples and Explanation
  • Count rows with at least n matching values
  • How to get last column number in range in Excel
  • Count rows that contain specific values in Excel
  • Find closest match in Excel

Data Validations

  • Excel Data validation date in specific year
  • Excel Data validation exists in list
  • Data validation must not exist in list
  • Excel Data validation specific characters only
  • Excel Data validation must begin with

If cell is x or y and z in Excel

by

This tutorial shows how to calculate If cell is x or y and z in Excel using the example below;

Formula

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

Explanation

You can combine logical statements with the OR and AND functions inside the IF function.

If color is red or green and quantity is greater than 10

In the example shown, we simply want to “mark” or “flag” records where the color is either red OR green AND the quantity is greater than 10.

In D5, the formula were using is this:

=IF(AND(OR(B5="red",B5="green"),C5>10),"x","")

How this formula works

In this formula, the logical test is this bit:

AND(OR(B5="red",B5="green"),C5>10)

Note that the “parent” function is AND The OR function is logical1 inside the AND function while C5>10 is logical2.

This snippet will return TRUE only when the color in B5 is either “red” OR “green” AND the quantity in C5 is greater than 10.

The IF function then simply catches the result of the above snippet and returns “x” when the result is TRUE and “” (nothing) when the result is false.

Note: if we didn’t add the empty string when FALSE, the formula would actually display FALSE whenever the color is not red.

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

  • How to return blank in place of #DIV/0! error in Excel
  • OR function Examples in Excel
  • SWITCH function: Description, Usage, Syntax, Examples and Explanation
  • How to use Excel AND Function
  • How to use Excel FALSE Function

Date Time

  • Check If Two Dates are same month in Excel
  • TIMEVALUE function: Description, Usage, Syntax, Examples and Explanation
  • How to calculate future date say 6 months ahead in Excel
  • How to calculate project start date based on end date in Excel
  • Two ways to sum time over 30 minutes in Excel

Grouping

  • Group arbitrary text values in Excel
  • Categorize text with keywords in Excel
  • Map text to numbers in Excel
  • Group times into 3 hour buckets in Excel
  • Group times into unequal buckets in Excel

General

  • Currency vs Accounting Format in Excel
  • How to set or clear a print area in Excel Worksheet
  • Basic numeric sort formula in Excel
  • How to test a range for numbers in Excel
  • How to count total number of cells in a rectangular range in Excel
© 2026 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning