Sign for or in excel

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 Excel Starter 2010 More…Less

Use the OR function, one of the logical functions, to determine if any conditions in a test are TRUE.

Example

Examples of using the OR function.

The OR function returns TRUE if any of its arguments evaluate to TRUE, and returns FALSE if all of its arguments evaluate to FALSE.

One common use for the OR function is to expand the usefulness of other functions that perform logical tests. For example, the IF function performs a logical test and then returns one value if the test evaluates to TRUE and another value if the test evaluates to FALSE. By using the OR function as the logical_test argument of the IF function, you can test many different conditions instead of just one.

Syntax

OR(logical1, [logical2], …)

The OR function syntax has the following arguments:

Argument

Description

Logical1

Required. The first condition that you want to test that can evaluate to either TRUE or FALSE.

Logical2, …

Optional. Additional conditions that you want to test that can evaluate to either TRUE or FALSE, up to a maximum of 255 conditions.

Remarks

  • The arguments must evaluate to logical values such as TRUE or FALSE, or in arrays or references that contain logical values.

  • If an array or reference argument contains text or empty cells, those values are ignored.

  • If the specified range contains no logical values, OR returns the #VALUE! error value.

  • You can use an OR array formula to see if a value occurs in an array. To enter an array formula, press CTRL+SHIFT+ENTER.

Examples

Here are some general examples of using OR by itself, and in conjunction with IF.

Examples of using the OR function with the IF function.

Formula

Description

=OR(A2>1,A2<100)

Displays TRUE if A2 is greater than 1 OR less than 100, otherwise it displays FALSE.

=IF(OR(A2>1,A2<100),A3,»The value is out of range»)

Displays the value in cell A3 if it is greater than 1 OR less than 100, otherwise it displays the message «The value is out of range».

=IF(OR(A2<0,A2>50),A2,»The value is out of range»)

Displays the value in cell A2 if it’s less than 0 OR greater than 50, otherwise it displays a message.

Sales Commission Calculation

Here is a fairly common scenario where we need to calculate if sales people qualify for a commission using IF and OR.

Example of using IF and OR to calculate sales commission.

  • =IF(OR(B14>=$B$4,C14>=$B$5),B14*$B$6,0)IF Total Sales are greater than or equal to (>=) the Sales Goal, OR Accounts are greater than or equal to (>=) the Account Goal, then multiply Total Sales by the Commission %, otherwise return 0.

Need more help?

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

Related Topics

Video: Advanced IF functions

Learn how to use nested functions in a formula

IF function

AND 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)

Need more help?

Purpose 

Test multiple conditions with OR

Return value 

TRUE if any arguments evaluate TRUE; FALSE if not.

Usage notes 

The OR function returns TRUE if any given argument evaluates to TRUE, and returns FALSE only if all supplied arguments evaluate to FALSE. The OR function can be used as the logical test inside the IF function to avoid nested IFs, and can be combined with the AND function.

The OR function is used to check more than one logical condition at the same time, up to 255 conditions, supplied as arguments. Each argument (logical1, logical2, etc.) must be an expression that returns TRUE or FALSE or a value that can be evaluated as TRUE or FALSE. The arguments provided to the OR function can be constants, cell references, arrays, or logical expressions. 

The purpose of the OR function is to evaluate more than one logical test at the same time and return TRUE if any result is TRUE. For example, if A1 contains the number 50, then:

=OR(A1>0,A1>75,A1>100) // returns TRUE
=OR(A1<0,A1=25,A1>100) // returns FALSE

The OR function will evaluate all values supplied and return TRUE if any value evaluates to TRUE. If all logicals evaluate to FALSE, the OR function will return FALSE. Note: Excel will evaluate any number except zero (0) as TRUE.

Both the AND function and the OR function will aggregate results to a single value. This means they can’t be used in array operations that need to deliver an array of results. To work around this limitation, you can use Boolean logic. For more information, see: Array formulas with AND and OR logic.

Examples

For example, to test if the value in A1 OR the value in B1 is greater than 75, use the following formula:

=OR(A1>75,B1>75)

OR can be used to extend the functionality of functions like the IF function. Using the above example, you can supply OR as the logical_test for an IF function like so:

=IF(OR(A1>75,B1>75), "Pass", "Fail")

This formula will return «Pass» if the value in A1 is greater than 75 OR the value in B1 is greater than 75.

Array form

If you enter OR as an array formula, you can test all values in a range against a condition. For example, this array formula will return TRUE if any cell in A1:A100 is greater than 15:

=OR(A1:A100>15)

Note: In Legacy Excel, this is an array formula and must be entered with control + shift + enter.

Notes

  • Each logical condition must evaluate to TRUE or FALSE, or be arrays or references that contain logical values.
  • Text values or empty cells supplied as arguments are ignored.
  • The OR function will return #VALUE if no logical values are found

Функция 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”.

На чтение 2 мин Просмотров 341 Опубликовано 10.12.2021

Эта функция поможет вам в том случае, когда необходимо проверить несколько логических условий.

Содержание

  1. Что возвращает функция ИЛИ (OR)?
  2. Синтаксис
  3. Важная информация
  4. Варианты использования ИЛИ
  5. Аргументы ИСТИНА и ЛОЖЬ прямо в формуле функции ИЛИ
  6. Аргументы ИСТИНА и ЛОЖЬ в ячейках на которые ссылаются аргументы функции ИЛИ
  7. Условия в аргументах функции
  8. Использование функции ИЛИ с числами
  9. Комбинируем функцию ИЛИ с другими функциями Excel

Что возвращает функция ИЛИ (OR)?

Если любое из условий, в аргументах функции, имеет значение ИСТИНА, то возвращает ИСТИНА, если нет, то ЛОЖЬ.

Синтаксис

=ИЛИ(любой_аргумент_имеющий_логическое_значение1; [любой_аргумент_имеющий_логическое_значение2];...)

Аргументами могут быть и вычисления — например, 1+1=2 — ИСТИНА.

Важная информация

  • Комбинация функций ЕСЛИ и ИЛИ позволяет проверить несколько логических утверждений за один вызов этих функций. Например, необходимо узнать, больше ли значение ячейки A1 чем 0 или меньше 100, в таком случае: =ЕСЛИ(ИЛИ(A1>100;A1<0); «Да»; «Нет»);
  • Обычный текст или пустые значения ячеек не сработают в аргументах функции;
  • Если аргументами функции не являются логически значения то функция выдаст ошибку #ЗНАЧ!;
  • Максимально, в аргументах, можно указать 255 значений.

Варианты использования ИЛИ

Давайте рассмотрим несколько вариантов использования функции

Аргументы ИСТИНА и ЛОЖЬ прямо в формуле функции ИЛИ

Спрашиваем у Экселя, что истинно, а что дозволено

Итак, как я уже говорил ранее, функция сравнивает каждое логическое значение и если находит ИСТИНУ, то возвращает ИСТИНА, если нет, то ЛОЖЬ. Если в первом аргументе функции вы использовали ИСТИНА, то вернется, соответственно, ИСТИНА.

Аргументы ИСТИНА и ЛОЖЬ в ячейках на которые ссылаются аргументы функции ИЛИ

Вторая проверка через ИЛИ

Тоже самое что и в примере выше, только мы используем ссылки на ячейки с логическими значениями.

Условия в аргументах функции

Ссылаемся на ячейки и сравниваем их через ИЛИ

Вы можете проверять какие-либо утверждения в аргументах функции.

Использование функции ИЛИ с числами

Если вы читаете статьи нашего сайта, вы знаете что все числа в Excel обладают логическими значениями. 0 — Ложь, а все остальные числа — ИСТИНА. Таким образом мы можем указывать числа в аргументах функции.

Комбинируем функцию ИЛИ с другими функциями Excel

И конечно же, можно комбинировать нашу функцию с другими функциями Excel. Наверное, это самый распространенный вариант использования.

Пример на картинке ниже:

Совмещаем ИЛИ и ЕСЛИ — это красиво)

Итак, наша функция проверяет больше ли значение ячейки A2 чем число 70, или значение ячейки A3 чем 70. Если любое из этих утверждений будет верно, результатом выполнения функции будет «Удачно», если же нет — «Неудачно».

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

Понравилась статья? Поделить с друзьями:
  • Sign a paper in word
  • Sign a letter in word
  • Sight words find a word
  • Sight word что это
  • Sight word you activities