Using or in excel equation

The IF function allows you to make a logical comparison between a value and what you expect by testing for a condition and returning a result if that condition is True or False.

  • =IF(Something is True, then do something, otherwise do something else)

But what if you need to test multiple conditions, where let’s say all conditions need to be True or False (AND), or only one condition needs to be True or False (OR), or if you want to check if a condition does NOT meet your criteria? All 3 functions can be used on their own, but it’s much more common to see them paired with IF functions.

Use the IF function along with AND, OR and NOT to perform multiple evaluations if conditions are True or False.

Syntax

  • IF(AND()) — IF(AND(logical1, [logical2], …), value_if_true, [value_if_false]))

  • IF(OR()) — IF(OR(logical1, [logical2], …), value_if_true, [value_if_false]))

  • IF(NOT()) — IF(NOT(logical1), value_if_true, [value_if_false]))

Argument name

Description

logical_test (required)

The condition you want to test.

value_if_true (required)

The value that you want returned if the result of logical_test is TRUE.

value_if_false (optional)

The value that you want returned if the result of logical_test is FALSE.

Here are overviews of how to structure AND, OR and NOT functions individually. When you combine each one of them with an IF statement, they read like this:

  • AND – =IF(AND(Something is True, Something else is True), Value if True, Value if False)

  • OR – =IF(OR(Something is True, Something else is True), Value if True, Value if False)

  • NOT – =IF(NOT(Something is True), Value if True, Value if False)

Examples

Following are examples of some common nested IF(AND()), IF(OR()) and IF(NOT()) statements. The AND and OR functions can support up to 255 individual conditions, but it’s not good practice to use more than a few because complex, nested formulas can get very difficult to build, test and maintain. The NOT function only takes one condition.

Examples of using IF with AND, OR and NOT to evaluate numeric values and text

Here are the formulas spelled out according to their logic:

Formula

Description

=IF(AND(A2>0,B2<100),TRUE, FALSE)

IF A2 (25) is greater than 0, AND B2 (75) is less than 100, then return TRUE, otherwise return FALSE. In this case both conditions are true, so TRUE is returned.

=IF(AND(A3=»Red»,B3=»Green»),TRUE,FALSE)

If A3 (“Blue”) = “Red”, AND B3 (“Green”) equals “Green” then return TRUE, otherwise return FALSE. In this case only the first condition is true, so FALSE is returned.

=IF(OR(A4>0,B4<50),TRUE, FALSE)

IF A4 (25) is greater than 0, OR B4 (75) is less than 50, then return TRUE, otherwise return FALSE. In this case, only the first condition is TRUE, but since OR only requires one argument to be true the formula returns TRUE.

=IF(OR(A5=»Red»,B5=»Green»),TRUE,FALSE)

IF A5 (“Blue”) equals “Red”, OR B5 (“Green”) equals “Green” then return TRUE, otherwise return FALSE. In this case, the second argument is True, so the formula returns TRUE.

=IF(NOT(A6>50),TRUE,FALSE)

IF A6 (25) is NOT greater than 50, then return TRUE, otherwise return FALSE. In this case 25 is not greater than 50, so the formula returns TRUE.

=IF(NOT(A7=»Red»),TRUE,FALSE)

IF A7 (“Blue”) is NOT equal to “Red”, then return TRUE, otherwise return FALSE.

Note that all of the examples have a closing parenthesis after their respective conditions are entered. The remaining True/False arguments are then left as part of the outer IF statement. You can also substitute Text or Numeric values for the TRUE/FALSE values to be returned in the examples.

Here are some examples of using AND, OR and NOT to evaluate dates.

Examples of using IF with AND, OR and NOT to evaluate dates

Here are the formulas spelled out according to their logic:

Formula

Description

=IF(A2>B2,TRUE,FALSE)

IF A2 is greater than B2, return TRUE, otherwise return FALSE. 03/12/14 is greater than 01/01/14, so the formula returns TRUE.

=IF(AND(A3>B2,A3<C2),TRUE,FALSE)

IF A3 is greater than B2 AND A3 is less than C2, return TRUE, otherwise return FALSE. In this case both arguments are true, so the formula returns TRUE.

=IF(OR(A4>B2,A4<B2+60),TRUE,FALSE)

IF A4 is greater than B2 OR A4 is less than B2 + 60, return TRUE, otherwise return FALSE. In this case the first argument is true, but the second is false. Since OR only needs one of the arguments to be true, the formula returns TRUE. If you use the Evaluate Formula Wizard from the Formula tab you’ll see how Excel evaluates the formula.

=IF(NOT(A5>B2),TRUE,FALSE)

IF A5 is not greater than B2, then return TRUE, otherwise return FALSE. In this case, A5 is greater than B2, so the formula returns FALSE.

Example of the Evaluate Formula Wizard

Using AND, OR and NOT with Conditional Formatting

You can also use AND, OR and NOT to set Conditional Formatting criteria with the formula option. When you do this you can omit the IF function and use AND, OR and NOT on their own.

From the Home tab, click Conditional Formatting > New Rule. Next, select the “Use a formula to determine which cells to format” option, enter your formula and apply the format of your choice.

Conditional Formatting > Edit Rule dialog showing the Formula method

Using the earlier Dates example, here is what the formulas would be.

Example of using AND, OR and NOT as Conditional Formatting tests

Formula

Description

=A2>B2

If A2 is greater than B2, format the cell, otherwise do nothing.

=AND(A3>B2,A3<C2)

If A3 is greater than B2 AND A3 is less than C2, format the cell, otherwise do nothing.

=OR(A4>B2,A4<B2+60)

If A4 is greater than B2 OR A4 is less than B2 plus 60 (days), then format the cell, otherwise do nothing.

=NOT(A5>B2)

If A5 is NOT greater than B2, format the cell, otherwise do nothing. In this case A5 is greater than B2, so the result will return FALSE. If you were to change the formula to =NOT(B2>A5) it would return TRUE and the cell would be formatted.

Note: A common error is to enter your formula into Conditional Formatting without the equals sign (=). If you do this you’ll see that the Conditional Formatting dialog will add the equals sign and quotes to the formula — =»OR(A4>B2,A4<B2+60)», so you’ll need to remove the quotes before the formula will respond properly.

Need more help?

Connect with an expert. Learn from live instructors.​​​​​​​

See also

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

Learn how to use nested functions in a formula

IF function

AND function

OR function

NOT function

Overview of formulas in Excel

How to avoid broken formulas

Detect errors in formulas

Keyboard shortcuts in Excel

Logical functions (reference)

Excel functions (alphabetical)

Excel functions (by category)

Функция OR (ИЛИ) в Excel используется для сравнения двух условий.

Содержание

  1. Что возвращает функция
  2. Синтаксис
  3. Аргументы функции
  4. Дополнительная информация
  5. Примеры использования функции OR (ИЛИ) в Excel
  6. Пример 1. Используем аргументы TRUE и FALSE в функции OR (ИЛИ)
  7. Пример 2. Используем ссылки на ячейки, содержащих TRUE/FALSE
  8. Пример 3. Используем условия с функцией OR (ИЛИ)
  9. Пример 4. Используем числовые значения с функцией OR (ИЛИ)
  10. Пример 5. Используем функцию OR (ИЛИ) с другими функциями

Что возвращает функция

Возвращает логическое значение TRUE (Истина), при выполнении условий сравнения в функции и отображает FALSE (Ложь), если условия функции не совпадают.

Синтаксис

=OR(logical1, [logical2],…) — английская версия

=ИЛИ(логическое_значение1;[логическое значение2];…) — русская версия

Аргументы функции

  • logical1 (логическое_значение1) — первое условие которое оценивает функция по логике TRUE или FALSE;
  • [logical2] ([логическое значение2]) — (не обязательно) это второе условие которое вы можете оценить с помощью функции по логике TRUE или FALSE.

Дополнительная информация

  • Функция OR (ИЛИ) может использоваться с другими формулами.

Например, в функции IF (ЕСЛИ) вы можете оценить условие и затем присвоить значение, когда данные отвечают условиям логики TRUE или FALSE. Используя функцию вместе с IF (ЕСЛИ), вы можете тестировать несколько условий оценки значений за раз.

Например, если вы хотите проверить значение в ячейке А1 по условию: “Если значение больше “0” или меньше “100” то… “ — вы можете использовать следующую формулу:

=IF(OR(A1>100,A1<0),”Верно”,”Неверно”) — английская версия

=ЕСЛИ(ИЛИ(A1>100;A1<0);»Верно»;»Неверно») — русская версия

  • Аргументы функции должны быть логически вычислимы по принципу TRUE или FALSE;
  • Текст и пустые ячейки игнорируются функцией;
  • Если вы используете функцию с не логически вычисляемыми значениями — она выдаст ошибку;
  • Вы можете тестировать максимум 255 условий в одной формуле.

Примеры использования функции OR (ИЛИ) в Excel

Пример 1. Используем аргументы TRUE и FALSE в функции OR (ИЛИ)

Функция OR (ИЛИ) в Excel

Вы можете использовать TRUE/FALSE в качестве аргументов. Если любой из них соответствует условию TRUE, функция выдаст результат TRUE. Если оба аргумента функции соответствуют условию FALSE, функция выдаст результат FALSE.

Telegram Logo Больше лайфхаков в нашем Telegram Подписаться

Она может использовать аргументы TRUE и FALSE в кавычках.

Пример 2. Используем ссылки на ячейки, содержащих TRUE/FALSE

Функция OR (ИЛИ) в Excel

Вы можете использовать ссылки на ячейки со значениями TRUE или FALSE. Если любое значение из ссылок соответствует условиям TRUE, функция выдаст TRUE.

Пример 3. Используем условия с функцией OR (ИЛИ)

Функция OR (ИЛИ) в Excel

Вы можете проверять условия с помощью функции OR (ИЛИ). Если любое из условий соответствует TRUE, функция выдаст результат TRUE.

Пример 4. Используем числовые значения с функцией OR (ИЛИ)

Функция OR (ИЛИ) в Excel

Число “0” считается FALSE в Excel по умолчанию. Любое число, выше “0”, считается TRUE (оно может быть положительным, отрицательным или десятичным числом).

Пример 5. Используем функцию OR (ИЛИ) с другими функциями

Вы можете использовать функцию OR (ИЛИ) с другими функциями для того, чтобы оценить несколько условий.

На примере ниже показано, как использовать функцию вместе с IF (ЕСЛИ):

Функция OR (ИЛИ) в Excel

На примере выше, мы дополнительно используем функцию IF (ЕСЛИ) для того, чтобы проверить несколько условий. Формула проверяет значение ячеек А2 и A3. Если в одной из них значение более чем “70”, то формула выдаст “TRUE”.

What is OR Function in Excel?

The OR function of Excel is used to test multiple conditions at the same time. A condition is an expression that evaluates to either “true” or “false” but not to both simultaneously. The OR function is categorized as a Logical function of Excel.

It returns either of the following outcomes:

  • True, if any of the conditions is true or all the conditions are true
  • False, if all the conditions are false

For example, the formula “=OR(2>4,8>5)” (ignore the double quotation marks) returns “true.” The first condition (2>4) evaluates to false, while the second condition (8>5) evaluates to true. Since one of the conditions is true, the final output is “true.”

A condition is supplied as an argument to the OR function. An argument can consist of numbers, text strings, cell references, formulas or Boolean values (true and false). The purpose of using the OR function is to assess whether any of the various conditions is met or not. It also facilitates multiple comparisons of data values.

Table of contents
  • What is OR Function in Excel?
    • Syntax of the OR Function of Excel
      • Example #1–Test Two Conditions Containing Numeric Values
      • Example #2–Test Two Conditions Containing a mix of Numerical and Textual Values
      • Example #3–Test Three Conditions Containing a mix of Numerical and Textual Values
      • Example #4–Test Three Conditions With a Nested OR or Nested AND Within the IF Function
    • Frequently Asked Questions
    • Recommended Articles

Syntax of the OR Function of Excel

The syntax of the OR function in excel is given in the following image:

Or syntax

The OR function accepts the following arguments:

  • Logical1: This is the first condition to be tested.
  • Logical2: This is the second condition to be tested.

“Logical1” is required, while “logical2” and the subsequent “logical” arguments are optional.

The OR function can be used either alone or in combination with the IF function of Excel. The benefits of using the OR function are expanded when it is combined with the AND and IF functions of ExcelIF function in Excel evaluates whether a given condition is met and returns a value depending on whether the result is “true” or “false”. It is a conditional function of Excel, which returns the result based on the fulfillment or non-fulfillment of the given criteria.
read more
. For such combinations, the OR and/or AND functionsThe AND function in Excel is classified as a logical function; it returns TRUE if the specified conditions are met, otherwise it returns FALSE.read more can be nested within the IF function.

Let us consider some examples to understand the working of the OR function of Excel. To know more about the nested OR function, refer to example #4 of this article.

Note 1: Each argument (condition) of the OR function must necessarily evaluate to either “true” or “false.” Moreover, each condition should consist of the relevant logical (or comparison) operator. There are six logical operators in ExcelLogical operators in excel are also known as the comparison operators and they are used to compare two or more values, the return output given by these operators are either true or false, we get true value when the conditions match the criteria and false as a result when the conditions do not match the criteria.read more. These are “equal to” (=), “not equal to” (<>), “greater than” (>), “greater than or equal to” (>=), “less than” (<), and “less than or equal to” (<=).

Note 2: A maximum of 255 conditions can be tested in Excel 2007 and the newer versions. In the earlier versions of Excel, a total of 30 conditions can be tested.

You can download this OR Function Excel Template here – OR Function Excel Template

Example #1–Test Two Conditions Containing Numeric Values

The succeeding image shows a number and the name of an unavailable website in cells A1 and A2 respectively. With the help of the OR function of Excel, evaluate the following conditions together:

  • The value of cell A1 is less than 10
  • The value of cell A1 is equal to 40

The steps to test the given conditions by using the OR function in excel are listed as follows:

Step 1: Insert the required logical operators in the given conditions. So, enter the following formula in cell C1.

“=OR(A1<10,A1=40)”

Here, the first condition is A1<10 and the second condition is A1=40.

Step 2: Press the “Enter” key. The output in cell C1 is “false.” This is because both the given conditions are false. Neither the value of cell A1 is less than 10, nor is it equal to 40.

The formula and the output are shown in the following image.

Excel OR Function Example 1

Example #2–Test Two Conditions Containing a mix of Numerical and Textual Values

Working on the dataset of example #1, we want to evaluate the following conditions together:

  • The value of cell A1 is equal to 45
  • The value of cell A2 is “Google.”

Use the OR function of Excel.

The steps to test the given conditions with the help of the OR function are listed as follows:

Step 1: Enter the following formula in cell C1.

“=OR(A1=45,A2=“Google”)”

We have inserted the appropriate logical operators in the given conditions. So, the first condition is A1=45 and the second condition is A2=“Google.”

Step 2: Press the “Enter” key. The output appears as “true” in cell C1.

In this example, the first condition is true as the value of cell A1 is equal to 45. The second condition is false as the value of cell A2 is not “Google.” Since one of the two conditions evaluate to true, the final output is “true.”

The formula and the output are shown in the following image.

Excel OR Function Example 2

Example #3–Test Three Conditions Containing a mix of Numerical and Textual Values

Working on the dataset of example #1, evaluate the following three conditions together:

  • The value of cell A1 is greater than or equal to 5
  • The value of cell A1 is equal to 35
  • The value of cell A2 is “e2esols.com.”

Use the OR function of Excel.

The steps to test the given conditions by using the OR function in excel are listed as follows:

Step 1: Insert the logical operators that fit the given conditions. So, enter the following formula in cell C1.

“=OR(A1>=5,A1=35,A2=“e2esols.com”)”

Here, the first, second, and third conditions are “A1>=5,” “A1=35,” and A2=“e2esols.com” respectively.

Step 2: Press the “Enter” key. The output in cell C1 is “true.”

The first condition evaluates to true because 45 (value of cell A1) is certainly greater than 5. The second condition is false as 45 is not equal to 35. The third condition is true as the value of cell A2 is “e2esols.com.”

So, two out of three conditions are true. Consequently, the final output is also “true.” Even if one of the three conditions had been true, the final output would still have been “true.”

The formula (entered in step 1) and the output are shown in the following image.

Excel OR Function Example 3

Example #4–Test Three Conditions With a Nested OR or Nested AND Within the IF Function

The succeeding table shows some random numbers in column A. In column B, the following three conditions are tested:

  • The value of cell A2 is less than 50
  • The value of cell A3 is not equal to 75
  • The value of cell A4 is greater than or equal to 100

The preceding conditions have been tested by using the following functions (in the given sequence):

  • OR function
  • AND function
  • IF and OR functions
  • IF and AND functionsThe IF AND excel formula is the combination of two different logical functions often nested together that enables the user to evaluate multiple conditions using AND functions. Based on the output of the AND function, the IF function returns either the “true” or “false” value, respectively.
    read more

Column C shows the outputs obtained by each formula of column B. The row numbers are displayed under the label “Sr. No,” which stands for serial number.

Consider each column and row of the table as the respective column and row of an Excel worksheet.

Sr. No A B C
1 DATA FORMULAS APPLIED RESULTS
2 50 =OR(A2<50,A3<>75,A4>=100) TRUE
3 25 =AND(A2<50,A3<>75,A4>=100) FALSE
4 99 =IF(OR(A2<50,A3<>75,A4>=100),”Data Error”,”Data Correct”) Data Error
5 =IF(AND(A2<50,A3<>75,A4>=100),”Data Error”,”Data Correct”) Data Correct

The conditions tested in column B and their outcomes are listed as follows:

  • A2<50: It evaluates to false as the value of cell A2 (50) is not less than 50.
  • A3<>75: It evaluates to true because the value of cell A3 (25) is not equal to 75.
  • A4>=100: It evaluates to false as the value of cell A4 (99) is neither greater than nor equal to 100.

The rows of column B are explained as follows:

Row 2: In this row, the three preceding conditions are tested (in cell B2) using the OR excel function. Since one of the three conditions is true, the final output of the OR function (in cell C2) is “true.”

Row 3: In this row, the three preceding conditions are tested (in cell B3) using the AND function. Since two out of three conditions are false, the final output of the AND function (in cell C3) is “false.”

Row 4: In this row, the given conditions are evaluated (in cell B4) using the nested OR function. Since the output of the OR function is “true” (as explained for row 2), the IF function considers that the logical test (condition) has been met. Consequently, the IF function returns the string defined as the “value_if_true” argument, which is “data error” (in cell C4).

Row 5: In this row, the three stated conditions are evaluated (in cell B5) using the nested AND function. The AND function returns the output “false” (as explained for row 3). So, the IF function realizes that the logical test has not been met. As a result, the IF function returns the string “data correct” (in cell C5), which is the “value_if_false” argument.

Note 1: The AND function returns “true” if all the tested conditions evaluate to true. It returns “false” if any of the conditions evaluate to false. Like the OR function, the AND function is also a logical function of Excel.

Note 2: In nesting functions, one function is placed inside another function. The function that is inside is known as a nested function. Excel calculates the nested function first, followed by the outer function. The output of the nested function is used as an argument of the outer function.

Frequently Asked Questions

1. State whether Excel has an OR function or not. If yes, define it.

Yes, Excel does have an OR function. The OR function is available in all versions of Excel. However, there are certain limitations related to the number of conditions that can be tested with the OR function.

Multiple conditions can be tested simultaneously by using the OR function of Excel. It is a logical function of Excel, which returns either of the two Boolean values (true and false) as the outcome. The OR function returns “true” if any or all conditions are true. It returns “false” if all conditions are false.

Note: For the meaning of condition and the number of conditions that can be tested, refer to the introduction and syntax discussed in this article.

2. How is the OR function of Excel used with the conditional formatting feature of Excel?

The steps to use the OR function with the conditional formatting feature are listed as follows:

a. Select the range on which conditional formatting needs to be applied.
b. From the Home tab, click the “conditional formatting” drop-down from the “styles” group. Select “new rule.”
c. The “new formatting rule” window opens. Choose the option “use a formula to determine which cells to format” under “select a rule type.”
d. Under “format values where this formula is true,” enter the OR formula. For instance, in the range A2:A10, if the numbers greater than 30 or equal to 25 need to be formatted, enter the formula “=OR(A2>30,A2=25)” (without the beginning and ending double quotation marks).
e. Click “format” and select a color from the “fill” tab. Click “Ok” to proceed.
f. Click “Ok” again in the “new formatting rule” window.

The cells of the selected range, for which either of the two conditions (A2>30,A2=25) is true, are colored. The cells, for which both conditions are false, are not colored.

Note 1: When a conditional formatting rule is applied using the OR function, every cell is checked for multiple conditions entered in step “d.” Each cell evaluates to either “true” or “false” and accordingly, formatting is applied. No cell can evaluate to both “true” and “false” at the same time.

Remember that with the OR function, a cell evaluates to “true” if any of the conditions is true. A cell evaluates to “false” if all conditions are false.

Note 2: One can enter more than two conditions in step “d.” Ensure that each condition is separated with commas, as shown by the syntax of the OR function.

3. How is the OR function used on text strings with the IF function of Excel?

To use the OR function with the IF function, insert the former (containing the conditions) within the latter. The text string of each condition must be enclosed within double quotation marks.

For instance, the ranges A2:A11 and B2:B11 contain the names of flowers and trees respectively. The formula “=IF(OR(A2=”rose”,B2=”maple”),”Yes”,”No”)” returns the following outcomes:

a. Yes, if either the first condition (A2=”rose”) or the second condition (B2=”maple”) is true.
b. No, if both conditions are false.

Hence, by combining the OR and IF functions, one can evaluate multiple conditions simultaneously and obtain customized responses for each row. These responses depend on the fulfillment or non-fulfillment of the stated conditions.

Note: Enter the IF and OR formula in Excel by excluding the beginning and ending double quotation marks. Press the “Enter” key after entering the given formula. Drag the formula if the outputs for the entire range are required.

Recommended Articles

This has been a guide to the OR function of Excel. Here we discuss how to use the OR formula in excel along step by step examples. You may also look at these useful functions in Excel–

  • OR Function in VBAOr is a logical function in programming languages, and we have an OR function in VBA. The result given by this function is either true or false. It is used for two or many conditions together and provides true result when either of the conditions is returned true.read more
  • True FunctionIn Excel, the TRUE function is a logical function that is used by other conditional functions such as the IF function. If the condition is met, the output is true; if the conditions are not met, the output is false.read more
  • NOT Excel Function | ExamplesNOT Excel function is a logical function in Excel that is also known as a negation function and it negates the value returned by a function or the value returned by another logical function.read more
  • Search Function in ExcelSearch function gives the position of a substring in a given string when we give a parameter of the position to search from. As a result, this formula requires three arguments. The first is the substring, the second is the string itself, and the last is the position to start the search.read more
  • YEARFRAC in ExcelYEARFRAC Excel is a built-in Excel function that is used to get the year difference between two date infractions. This function returns the difference between two dates infractions like 1.5 Years, 1.25 Years, 1.75 Years, etc. So using this function we can find the year difference between two dates accurately.read more

Logical functions are designed to test one or several conditions, and perform the actions prescribed for each of the two possible results. Such results can only be logical TRUE or FALSE.

Excel contains several logical functions such as IF, IFERROR, SUMIF, AND, OR, and others. The last two are not used in practice, as a rule, because the result of their calculations may be one of only two possible options (TRUE, FALSE). When combined with the IF function, they are able to significantly expand its functionality.



Examples of using formulas with IF, AND, OR functions in Excel

Example 1. When calculating the cost of the amount of consumed kW of electricity for subscribers, the following conditions are taken into account:

  1. If less than 3 people live in the apartment or less than 100 kW of electricity was consumed per month, the rate per 1 kW is 4.35$.
  2. In other cases, the rate for 1 kW is 5.25$.

Calculate the amount payable per month for several subscribers.

View source data table:

Example 1.

Perform the calculation according to the formula:

Argument Description:

  • OR (B3<=2,C3<100) is a logical expression that verifies two conditions: do less than 3 people live in the apartment or does the total amount of energy consumed less than 100 kW? The result of the test will be TRUE if either of these two conditions is true;
  • C3 * 4.35 — the amount to be paid, if the OR function returns TRUE;
  • C3 * 5.25 is the amount to be paid if OR returns FALSE.

We stretch the formula for the remaining cells using the autocomplete function. The result of the calculation for each subscriber:

several logical functions.

Using the AND function in the formula in the first argument in the IF function, we check the conformity of the values by two conditions at once.



Formula with IF and AVERAGE functions for selecting of values by conditions

Example 2. Applicants entering the university for the specialty «mechanical engineer» are required to pass 3 exams in mathematics, physics and English. The maximum score for each exam is 100. The average passing score for 3 exams is 75, while the minimum score in physics must be at least 70 points, and in mathematics it is 80. Determine applicants who have successfully passed the exams.

View source table:

Example 2.

To determine the enrolled students use the formula:

Argument Description:

  • AND(B4>=80,C4>=70,AVERAGE(B4:D4)>=75) — checked logical expressions according to the condition of the problem;
  • «Enroll» — the result, if the function AND returned the value TRUE (all expressions represented as its arguments, as a result of the calculations returned the value TRUE);
  • «Not Enroll» — the result if AND returned FALSE.

Using the autocomplete function (double-click on the cursor marker in the lower right corner), we get the rest of the results:

Formula with IF and AVERAGE.

Formula with logical functions AND IF OR in excel

Example 3. Subsidies in the amount of 30% are charged to families with an average income below 8,000$, which are large or there is no main breadwinner. If the number of children is over 5, the amount of the subsidy is 50%. Determine who should receive subsidies and who should not.

View source table:

Example 3.

To check the criteria according to the condition of the problem, we write the formula:

Argument Description:

  • AND(B3<8000,OR(C3=TRUE,E3=FALSE)) is the checked expression according to the condition of the problem. In this case, the AND function returns the TRUE value, if B3 <8000 is true and at least one of the expressions passed as arguments to the OR function also returns the TRUE value.
  • The nested IF function performs a check on the number of children in the family, which rely on subsidies.
  • If the main condition returned the result is FALSE, the main function IF returns the text string “no”.

Perform the calculation for the first family and stretch the formula to the remaining cells using the autocomplete function. Results:

functions AND IF OR.

Features of using logical functions IF, AND, OR in Excel

The IF function has the following syntax notation:

=IF(Logical_test,[ Value_if_True ],[ Value_if_False])

As you can see, by default, you can check only one condition, for example, is e3 more than 20? Using the IF function, this check can be done as follows:

=IF(EXP(3)>20,»more»,»less»)

As a result, the text string “more” will be returned. If we need to find out if any value belongs to the specified interval, we will need to compare this value with the upper and lower limits of the intervals, respectively. For example, is the result of calculating e3 in the range from 20 to 25? When using the IF function alone, you must enter the following entry:

=IF(EXP(3)>20,IF(EXP(3)<25,»belongs»,»does not belong»),»does not belong»)

We have a nested function IF as one of the possible results of the implementation of the main function IF, and therefore the syntax looks somewhat cumbersome. If you also need to know, for example, whether the square root e3 is equal to a numeric value from a fractional number range from 4 to 5, the final formula will look cumbersome and unreadable.

It is much easier to use as a condition a complex expression that can be written using AND and OR functions. For example, the above function can be rewritten as follows:

=IF(AND(EXP(3)>20,EXP(3)<25),»belongs»,»does not belong»)

The result of the execution of the AND expression (EXP(3)>20,EXP(3)<25) can be a logical value TRUE only if the result of checking each of the specified conditions is a logical value TRUE. In other words, the function AND allows you to test one, two or more hypotheses on their truth, and returns the result FALSE if at least one of them is incorrect.

Sometimes you want to know if at least one assumption is true. In this case, it is convenient to use the OR function, which performs the check of one or several logical expressions and returns a logical TRUE, if the result of the calculations of at least one of them is a logical TRUE. For example, you want to know if e3 is an integer or a number that is less than 100? To test this condition, you can use the following formula:

=IF(OR(MOD(EXP(3),1)<>0,EXP(3)<100),»true»,»false»)

The “<>” means inequality, that is, more or less than some value. In this case, both expressions return the value TRUE, and the result of the execution of the IF function is the text string «true.» However, if an OR test was performed (MOD(EXP (3),1)<>0,EXP(3)<20, while EXP(3) <20 will return FALSE, the result of the calculation of the IF function will not change, since MOD(EXP(3),1) <> 0 returns TRUE.

Download examples using the functions OR AND IF in Excel

In practice, often used bundles IF + AND, IF + OR, or all three functions at once. Consider examples of similar use of these functions.

Excel IF AND OR functions on their own aren’t very exciting, but mix them up with the IF Statement and you’ve got yourself a formula that’s much more powerful.

In this tutorial we’re going to take a look at the basics of the AND and OR functions and then put them to work with an IF Statement.  If you aren’t familiar with IF Statements, click here to read that tutorial first.

IF Formula Builder

IF Formula Builder

Our IF Formula Builder does the hard work of creating IF formulas.

You just need to enter a few pieces of information, and the workbook creates the formula for you.

AND Function

The AND function belongs to the logic family of formulas, along with IF, OR and a few others.  It’s useful when you have multiple conditions that must be met.

In Excel language on its own the AND formula reads like this:

=AND(logical1,[logical2]....)

Now to translate into English:

=AND(is condition 1 true, AND condition 2 true (add more conditions if you want)

OR Function

The OR function is useful when you are happy if one, OR another condition is met.

In Excel language on its own the OR formula reads like this:

=OR(logical1,[logical2]....)

Now to translate into English:

=OR(is condition 1 true, OR condition 2 true (add more conditions if you want)

See, I did say they weren’t very exciting, but let’s mix them up with IF and put AND and OR to work.

IF AND Formula

First let’s set the scene of our challenge for the IF, AND formula:

In our spreadsheet below we want to calculate a bonus to pay the children’s TV personalities listed.  The rules, as devised by my 4 year old son, are:

1)      If the TV personality is Popular AND

2)      If they earn less than $100k per year they get a 10% bonus (my 4 year old will write them an IOU, he’s good for it though).

Excel IF AND OR Functions IF AND example

In cell D2 we will enter our IF AND formula as follows:

In English first

=IF(Spider Man is Popular, AND he earns <$100k),  calculate his salary x 10%, if not put "Nil" in the cell)

Now in Excel’s language:

=IF(AND(B2="Yes",C2<100),C2x$H$1,"Nil")

You’ll notice that the two conditions are typed in first, and then the outcomes are entered.  You can have more than two conditions; in fact you can have up to 30 by simply separating each condition with a comma (see warning below about going overboard with this though).

IF OR Formula

Again let’s set the scene of our challenge for the IF, OR formula:

The revised rules, as devised by my 4 year old son, are:

1)      If the TV personality is Popular OR

2)      If they earn less than $100k per year they get a 10% bonus.

IF OR Formula

In cell D2 we will enter our IF OR formula as follows:

In English first

=IF(Spider Man is Popular, OR he earns <$100k), calculate his salary x 10%, if not put “Nil” in the cell)

Now in Excel’s language:

=IF(OR(B2="Yes",C2<100),C2x$H$1,"Nil")

Notice how a subtle change from the AND function to the OR function has a significant impact on the bonus figure.

Just like the AND function, you can have up to 30 OR conditions nested in the one formula, again just separate each condition with a comma.

Try other operators

You can set your conditions to test for specific text, as I have done in this example with B2=»Yes», just put the text you want to check between inverted comas “   ”.

Alternatively you can test for a number and because the AND and OR functions belong to the logic family, you can employ different tests other than the less than (<) operator used in the examples above.

Other operators you could use are:

  • =             Equal to
  • >             Greater Than
  • <=           Less than or equal to
  • >=           Greater than or equal to
  • <>           Less than or greater than

Warning: Don’t go overboard with nesting IF, AND, and OR’s, as it will be painful to decipher if you or someone else ever needs to update the formula in months or years to come.

Note: These formulas work in all versions of Excel, however versions pre Excel 2007 are limited to 7 nested IF’s.

Download the Workbook

Enter your email address below to download the sample workbook.

By submitting your email address you agree that we can email you our Excel newsletter.

Excel IF AND OR Practice Questions

IF AND Formula Practice

In the embedded Excel workbook below insert a formula (in the grey cells in column E), that returns the text ‘Yes’, when a product SKU should be reordered, based on the following criteria:

  1. If Stock on hand is less than 20,000 AND
  2. Demand level is ‘High’

If the above conditions are met, return ‘Yes’, otherwise, return ‘No’.

Tips for working with the embedded workbook:

  1. Use arrow keys to move around the worksheet when you can’t click on the cells with your mouse
  2. Use shortcut keys CTRL+C to copy and CTRL+V to paste
  3. Don’t forget to absolute cell references where applicable
  4. Do not enter anything in column F
  5. Double click to edit a cell
  6. Refresh the page to reset the embedded workbook

IF OR Formula Practice

In the embedded Excel workbook below insert a formula (in the grey cells in column E) that calculates the bonus due for each salesperson. A $500 bonus is paid if a salesperson meets either target in cells C24 and C25, otherwise they earn $0 bonus.

Want More Excel Formulas

Why not visit our list of Excel formulas. You’ll find a huge range all explained in plain English, plus PivotTables and other Excel tools and tricks. Enjoy 🙂

or formula in excel

OR Formula in Excel (Table of Contents)

  • OR Formula in Excel
  • How to Use OR Formula in Excel?

OR Formula in Excel

  • MS Excel provides several logical inbuilt functions; one of them is the OR function, which is used to test multiple scenarios or conditions at the same time. As it is a Logical function, it will only return True or False. A user can use the OR function with other Logical functions also like AND, OR, XOR, etc.
  • It will return true if any single argument or condition is true; else, it will return false. A user can test up to 255 arguments in the OR function.

Syntax of the ‘OR’ Function:

OR () – It will return a Boolean value which will be either true or false depending on the argument provided inside the or function.

OR Formula Syntax

The Argument in the Function:

  • Logical1: It is a mandatory field, first condition, or logical value that a user wants to evaluate.
  • Logical2: It is an optional field, it provided by the user which he wants to compare or test with other condition or logical value.

How to Use OR Formula in Excel?

OR Formula in Excel is very simple and easy. Let’s understand how to use the OR Formula in Excel with some examples.

You can download this OR Formula Excel Template here – OR Formula Excel Template

Example 1

A user has A, B, and C conditions that he wants to evaluate in the OR function.

Let’s see how the ‘OR’ function can solve his problem to calculate.

  • Open the MS Excel, Go to the Sheet where the user wants to execute his OR function.

OR Formula IN Excel 1-1

  • Create a Header Column with OR Result in the D column where we will execute the OR function.

OR Formula in Excel 1-2

  • Now apply the OR function in the cell D2.

OR Formula in Excel 1-3

  • Now it will ask for Logical1, which is available in the A column, then select the Value from the A2 cell.

OR Formula in Excel 1-4

  • Now it will ask for Logical2, Logical2, … which is available in the B column and C column.
  • Select Value from the B2 and C2 cells.

OR Formula in Excel 1-5

  • Press on the Enter Button, and the result is shown below.

OR Formula in Excel 1-6

  • Now Apply the Same Formula to Other Cells by just dragging the D2 formula till D5.

OR Formula in Excel 1

Summary of Example 1:

As the user wants to execute the OR function for different conditions, we have done in the above example.

As we can see, if a single condition is true, then we are getting True as the OR output that is row 3 to 5. If all condition is false, then only we are getting false as OR output that is row no 2.

Example 2

A User has a List of Student Score Card for Math and English, which he wants to evaluate for Pass and Fail, where he decides the minimum Score to Pass is 75 out of 100.

Let’s see how the ‘OR’ and ‘IF’ function can solve this problem to evaluate the Fail or Pass status of the student.

  • Open MS Excel, Go to Sheet where the user wants to evaluate Fail or Pass Status of the Student.

OR example 2-1

  • Create a header column with ‘OR Output With If’ in column E to execute the OR function.

OR example 2-2

  • Now apply the IF Function in the cell E2.

OR example 2-3

  • Add OR Function to check if in any subject student is scoring below 75.

OR example 2-4

  • Now it will ask for Logical1, which is Math Score needs to compare against Passing Score 75. So, just compare Math Score, which is available in the B column.

OR example 2-5

  • Now it will ask for Logical1, Logical2, … which is an English score which needs to be compared against passing score 75. So, just compare the English Score, which is available in Column C.

OR example 2-6

  • It will then ask the value if it is True, so if the student fails, his scores will be below 75 in any subject.

OR example 2-7

  • Now it will ask the value if it is False, and if the student is passed, his scores will be above or equal to 75 in all subjects.

OR example 2-8

  • Press the Enter Button, and the result will be shown below.

OR example 2-9

  • Now apply the same Formula to other Cells by just dragging the E2 formula till E9.

or formula in Excel 2

  • Now to apply AND Formula with OR, we will create one Header in the F column and check if any student has passed in Math or Science or English.

or example 2-10

  • Now apply AND & OR function to the G column.

OR in excel 2-12

  • After applying this formula, the result is shown below.

or example 2-11

  • Now apply the Same Formula to other Cells by just dragging the G2 formula till G4.

or example 3-6

Summary of Example 2:

As the user wants to execute the OR and IF function for different conditions, we have done in the above example.

As we can see, if a single condition is true, then we are getting FAIL as the OR output that is row no 6, 8, 9, and 10. If all condition is false, then only we are getting PASS as the OR output that is row no 3, 4, 5 and 7.

Example 3

A user has a list of Student Score Card for Science and English, which he wants to evaluate for FALSE and TRUE, where he decides the minimum pass score to pass is 33 out of 100.

Let’s see how the ‘XOR’ function can solve his problem to calculate.

  • Open the MS Excel, go to sheet3 where the user wants to execute his OR function.

or example 3-1

  • Create a header column with XOR Result in the E column where we will execute the XOR function.

or example 3-2

  • Now apply the XOR function in the cell E2.

or excel 3-6

  • Press on the Enter Button and see the result below.

or example 3-4

  • Now apply the Same Formula to other Cells by just dragging the E2 formula till E4.

or excel example 3.gif

Summary of Example 3: As the user wants to execute the XOR function for different conditions, we have done in the above example.

The XOR formula is Exclusive OR, where an odd number of conditions or True otherwise will always return False.

Things to Remember About OR Formula in Excel

  1. The OR function will return true if any single argument or condition is true; else, it will return false.
  2. A user can test up to 255 arguments in the OR function.
  3. If there is no logical value coming as an argument, then it will throw an error #VALUE.
  4. A user can use the OR function with other Logical functions also like AND, OR, XOR, etc.

Recommended Articles

This has been a guide to OR Formula in Excel. Here we discuss How to use OR Formula in Excel along with practical examples and a downloadable excel template. You can also go through our other suggested articles –

  1. OR Excel Function
  2. VBA OR
  3. Logical Functions in Excel
  4. Excel IF AND Function
Skip to content

Excel AND + OR Functions: Full Guide (with IF Formulas)

Excel AND + OR Functions: Full Guide (with IF Formulas)

The AND and OR functions returns True or False if certain conditions are met.

Combined with other functions, like IF, that enables multiple criteria logic in your formulas.

In this guide, I’ll walk you through all of this, step-by-step 👍🏼

If you want to tag along, download the sample workbook here.

We use the data in the following table to learn how to apply OR and AND function with the IF function in excel.

Example to apply OR function and AND function with the IF function

The OR function

The OR function is one of the most important logical functions in excel 😯

The OR function in Excel returns True if at least one of the criteria evaluates to true.

If all the arguments evaluate as False, then the OR function returns False.

The syntax of the OR function in Excel is OR(logical1, [logical2], …).

Assume that employees are eligible for an incentive if they achieve a value or volume target of 75% or more 🏆

Let’s try OR function for the above example.

  1. Enter an equal sign and select the OR function.

You will see below in the formula bar.

=OR(

Select the OR function Excel
  1. Supply the first logical value to evaluate as the first argument.

You can write logical values to test using logical operators.

In this case, we want to first test, whether the value target achievement is greater than or equal to 75%.

So, we can give the cell reference and write the condition >=75%.

Now the formula is,

=OR(B3>=75%

Entering logical values - 1st logical value
  1. Enter a comma and enter the 2nd logical value for the logical test.

Then, we enter the logical value for the volume target.

Now, the updated formula is;

=OR(B3>7=75%,C3>=75%

Entering logical values - 2nd logical value
  1. Close the parentheses and press enter.

The below Excel formula evaluates arguments.

=OR(B3>7=75%,C3>=75%)

Then returns true if at least one of the value or volume target achievements is greater than or equal to 75%. If both value and volume target achievements are below 75%, the OR function returns False.

The OR function evaluate arguments for two values and return true or false

Pro Tip:

Now you have learned, the OR function returns True even when more than one condition evaluates to “True”.

Do you think you have to combine the OR function with the NOT function?

No. Excel has a simple solution 😜

You have to use the XOR function.

Apply the below XOR formula to the above example and see how the results are changing.

=XOR(B3>7=75%,C3>=75%)

Using the XOR instead of OR function

You can see that Mary’s result is “False” as her achievements are not satisfying the one and only condition.

OR function IF formula example

Isn’t it boring to see only “True or false” values? 🥱

Don’t you like to get something other than True or False values? 👍

You just need to combine the OR function with the IF function in Excel.

Let’s say, we want the function to return “Eligible” if at least one of the value or volume target achievements is greater than or equal to 75%.

Also, return “Not eligible”, if both value and volume target achievements are less than 75%.

  1. Enter the equal sign and select the IF function.

Now, the formula bar will show;

Selecting the IF function to apply the OR function in Excel
  1. Enter the OR function that we have learned in the previous section.

The updated formula should be like this.

=IF(OR(B3>=75%,C3>=75%)

Insert the OR function as the test argument of the IF function in Excel.
  1. Enter the specific value you want the function to return when the result of the logical test is True.

In this case, we want to get “Eligible”.

So, we enter the word eligible within quotes.

Now, the formula is;

=IF(OR(B3>=75%,C3>=75%),”Eligible”

Providing the value to be returned if the logical test result is True.

If you want to enter text values for the arguments, you have to enter them within quotes. However, you don’t need to enter True or false values within quotes. Excel automatically evaluates arguments provided with true or false values.

Kasper Langmann, Microsoft Office Specialist
  1. Enter the specific value you want the function to return when the result of the logical test is False.

In this case, we want to get “Not Eligible”.

Now, the updated formula is;

=IF(OR(B3>=75%,C3>=75%),”Eligible”,”Not Eligible”

Providing the value to be returned if the logical test result is False.
  1. Close the parentheses and press “Enter”.
Combining IF and OR functions in Excel to get the expected value.

The AND function

AND function is another important logical function in excel.

This function returns true all of the multiple criteria are true.

Otherwise, the AND function returns False.

The syntax of the AND function in Excel is AND(logical1, [logical2], …).

Say that employees are entitled to an incentive if they achieve more than or equal to 75% for both the value target and volume target.

Let’s try AND function for the above example.

  1. Enter an equal sign and select the AND function.

You will see below in the formula bar.

=AND(

Entering the AND function in Excel.
  1. Enter all logical values to test using logical operators.

So, you can enter the following formula.

=AND(B3>=75%,C3>=75%

Entering arguments to test multiple conditions
  1. Close the parentheses and press “Enter”.
The AND function example

You can see that the AND function returns true only when both the value and volume target achievements exceed or are equal to 75% 🥳

However, there is limited usage of AND function if we do not combine it with other functions in Excel 🤔

Let’s see an example with a combination of the IF function and AND function.

AND function IF formula example

Let’s say, we want the function to return “Eligible”, only when both value and volume target achievements are more than or equal to 75%.

Otherwise, we want to get “Not eligible”

  1. Enter the equals sign and select the IF function.

Now, the formula bar will show;

Selecting the IF function
  1. Enter the AND function that we have learned in the previous section.

The updated formula should be like this.

=IF(AND(B3>=75%,C3>=75%)

  1. Enter the specific value you want the function to return when the result of the logical test is True.

In this case, we want to get “Eligible”.

So, we enter the word eligible within quotes.

Now, the formula is;

=IF(AND(B3>=75%,C3>=75%),”Eligible”

Providing the value to be returned if the logical test result is True - Excel AND function
  1. Enter the specific value you want the function to return when the result of the logical test is False.

In this case, we want to get “Not Eligible”.

Now, the updated formula is;

=IF(AND(B3>=75%,C3>=75%),”Eligible”,”Not Eligible”

Providing the value to be returned if the logical test result is False - Excel AND function
  1. Close the parentheses and press “Enter”.
Combining IF and AND functions in Excel to get the desired result.

You can see that we get “Eligible” only when all of the multiple conditions are True. Otherwise, functions will return false 😍

Any empty cells in a logical function’s argument are ignored.

Kasper Langmann, Microsoft Office Specialist
Any empty cells in a logical function's argument are ignored

That’s it – Now what?

Well done 👏🏻

Now you know how to use the OR and AND functions in Excel.

Using the above examples, you have learned that OR and AND functions are more powerful when we combine them with other Excel functions 💪🏻

To learn more about other important functions such as IF, SUMIF, and VLOOKUP functions, all you need to do is enroll in my free 30-minute online Excel course.

Other resources

When you are using OR and AND functions, it is extremely important to use logical operators correctly ⚡

Read our article about logical operators, if you want to refresh your knowledge about them.

Also, Read our articles about the IF function, nested IF function, and SUMIF function and apply OR and AND functions more effectively 🥳

Frequently asked questions

You can enter 2 conditions or more for the logical test argument of the IF function using the following formulas.

If you want to satisfy,

  • Both conditions – use the AND function.
  • At least one condition – use the OR function
  • Only one condition – use the XOR function.

Yes. We can use multiple logical functions with the IF function in Excel.

You can combine OR and AND functions to evaluate the arguments appropriately.

Kasper Langmann2023-02-23T11:04:48+00:00

Page load link

Categorized as a logical function, the Excel OR function checks multiple conditions (passed as arguments) to verify whether any of the conditions turn out to be TRUE. The OR function in Excel either returns a TRUE or a FALSE. It returns FALSE only if all arguments evaluate to FALSE. The function returns TRUE even if a single argument evaluates to TRUE.

This logical function will help you compare data and test multiple conditions. Quite a helping hand, OR function has seen many days since its debut in 2003.

If you are familiar with the AND function, you will notice how similar the two functions are. As with most logical functions, the OR function has its brighter moments combined with other functions. Of course, we have the details for you, but let’s cut into the simpler bits first.

Excel OR Function

Syntax

The syntax of the OR function is as follows:

=OR(logical1, [logical2], ...)

Arguments:

logical1 – The first condition to be tested.
logical2 – The second condition to be tested. Entering this argument is optional.

Important Characteristics of OR Function in Excel

  • OR function returns either «TRUE» or «FALSE» and can evaluate up to 255 conditions.
  • If an argument is the number 0, the result will be «FALSE».
  • If no logical values are found in the formula, the function returns a #VALUE! error.
  • If the formula has any typos or misspelling, the function returns a #NAME? error.
  • The arguments can be numbers, cell references, defined names, formulas, functions, or text.

Examples of OR Function

Let’s put stuff to work and try to understand the function with some examples.

Example 1 – OR Function With a Single Parameter

OR function can be used with a single Boolean parameter or any expression that results in a Boolean value.

The formula simply would be:

=OR(TRUE) //returns TRUE
=OR("A"="A") //returns TRUE
=OR(1 < 5) //returns TRUE
=OR(FALSE) //returns FALSE
=OR("A"="Z") //returns FALSE
=OR(7 > 10) //returns FALSE
=OR("abc") //returns #VALUE! error

The function evaluates the condition to be logically either TRUE or FALSE and returns the relevant result. Here we have fed only one logical condition into the function. Let’s move on to the effects of working in twos.

Example 2 – OR Function With Two or More Parameters

Now we will use OR function with two Boolean parameters/expressions that result in a Boolean value.

The function makes a selection based on the fulfillment of multiple conditions very easy. We’ll show you how through this example.

Excel-OR-Function-Example-1

Our example is made up of marks scored by students in two tests (column C) and (column D). Students must clear at least one test to pass the subject. Passing marks for each test are 75 or more.

OR function-wise, what that means is that one condition must be fulfilled to return the result TRUE. We have applied the formula as:

=OR(C2 >= 75,D2 >= 75)

One of the values from either cell «C2» or «D2» must be at least 75 in order for the student to pass and the result to return as «TRUE».

Case 1 – When Both Parameters Evaluate to TRUE

Student «Dean Ricci» has scored 76 marks in Test 1 and 90 marks in Test 2. Both scores are above the required 75 marks. Both the conditions fed into the function are TRUE, and the result is «TRUE».

Case 2 – When Both Parameters Evaluate to FALSE

Not all students are as lucky as Dean, and as we have it, student «Preston Hall» scores 40 and 45 marks in the tests respectively. Both the conditions in the function have not been met, which means it’s a «FALSE, FALSE» situation; the scores are less than75, and so the result comes as «FALSE». FALSE is returned by the OR function when all the arguments evaluate to FALSE.

Case 3 – When One Parameter is TRUE, the Other is FALSE

«Augusta Stone» has scored 84 and 45 in tests 1 and 2 respectively. As you can see, the first condition, «C6 >= 75» is met as the score is 84; that part of the function gives a TRUE result. «D6>=75» is not met since the score is 45 in test 2, and this part of the function gives a FALSE result. Since one out of the two conditions supplied to the function are met, the OR function processes this as TRUE and returns «TRUE».

Note how the result won’t be TRUE and FALSE separately for the corresponding expressions; the function equates all expressions to return a single Boolean value as a result. Even though one logical condition (D6>=75) is not met, the function returns «TRUE» if any one condition is met [(C6>=75) in this case]. This means that the OR function will only result in FALSE when all the supplied parameters/expressions evaluate to FALSE. If any expression returns TRUE, the result of the OR function will be TRUE.

The same can be said for student 6; the first condition (C7>=75) is not met while the second (D7>=75) is. This has also resulted in «TRUE» by the function.

Example 3 – Use of OR Function with IF Function

The role of an IF function is to return a value based on a stated condition. IF functions can be nested within each other to develop formulas for handling complex logic.

Instead of having several nested IF functions to test multiple conditions, the OR function can be nested within the IF function to get a similar customized result.

Continuing with the example from above, we will show you how the functions work together.

Excel-OR-Function-Example-2

The plus point here of using the OR function within the IF function is that we can get:

  • «Pass» instead of «TRUE» and
  • «Fail» instead of «FALSE»

as the result.

We achieve this by the following formula:

=IF(OR(C2 >= 75,D2 >= 75),"Pass","Fail")

The OR function comes into play first. It looks up marks in cells C2 and D2 to be greater than or equal to 75. The OR function checks if any one of the conditions is met and it returns a «TRUE». The result is passed onto the IF function where the corresponding value for TRUE is «Pass»; hence IF function returns «Pass» as the result.

Example 4 – Use of OR Function in Array Form

The OR function can also be used to evaluate a range of cells and determine whether the condition specified, is met in at least one of the cells in the range. Let’s take some help from an example.

Excel-OR-Function-Example-3

In this example, we have a list of students along with their scores. Our objective is to check and see if any student on the list has scored 95 or more.

To accomplish this, we can make use of the OR function in array form as:

{=OR(C2:C11 >= 95)}

Note: This is an array formula and must be entered with Ctrl + Shift + Enter keys, except in Excel 365.

In the above formula, we are asking the OR function to take each cell in the given range i.e. C2:C11, and check if the value in any one of the cells is greater than or equal to 95. If even a single cell in the range has a value greater than or equal to 95, the function returns TRUE otherwise it returns FALSE.

Since in our case student 2 «Disha Varma» has a score of 95, hence the condition is satisfied and the OR function returns a TRUE.

It’s a wrap! You can alt + f4 now «or» you can read on.

Here’s an Excel joke for you:

What if you clicked undo so many times

IT TURNED BACK INTO EXCEL 2.0

We’ll let you sit with that one while we prep another Excel function (without so many undos).

Like this post? Please share to your friends:
  • Using or conditional formatting excel
  • Using only one word перевод
  • Using one word to mean another
  • Using one word for two meanings
  • Using one word for another