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
To get detailed information about a function, click its name in the first column.
Note: Version markers indicate the version of Excel a function was introduced. These functions aren’t available in earlier versions. For example, a version marker of 2013 indicates that this function is available in Excel 2013 and all later versions.
Function |
Description |
---|---|
AND function |
Returns TRUE if all of its arguments are TRUE |
BYCOL function |
Applies a LAMBDA to each column and returns an array of the results |
BYROW function |
Applies a LAMBDA to each row and returns an array of the results |
FALSE function |
Returns the logical value FALSE |
IF function |
Specifies a logical test to perform |
IFERROR function |
Returns a value you specify if a formula evaluates to an error; otherwise, returns the result of the formula |
IFNA function |
Returns the value you specify if the expression resolves to #N/A, otherwise returns the result of the expression |
IFS function |
Checks whether one or more conditions are met and returns a value that corresponds to the first TRUE condition. |
LAMBDA function |
Create custom, reusable functions and call them by a friendly name |
LET function |
Assigns names to calculation results |
MAKEARRAY function |
Returns a calculated array of a specified row and column size, by applying a LAMBDA |
MAP function |
Returns an array formed by mapping each value in the array(s) to a new value by applying a LAMBDA to create a new value |
NOT function |
Reverses the logic of its argument |
OR function |
Returns TRUE if any argument is TRUE |
REDUCE function |
Reduces an array to an accumulated value by applying a LAMBDA to each value and returning the total value in the accumulator |
SCAN function |
Scans an array by applying a LAMBDA to each value and returns an array that has each intermediate value |
SWITCH function |
Evaluates an expression against a list of values and returns the result corresponding to the first matching value. If there is no match, an optional default value may be returned. |
TRUE function |
Returns the logical value TRUE |
XOR function |
Returns a logical exclusive OR of all arguments |
Important: The calculated results of formulas and some Excel worksheet functions may differ slightly between a Windows PC using x86 or x86-64 architecture and a Windows RT PC using ARM architecture. Learn more about the differences.
See Also
Excel functions (by category)
Excel functions (alphabetical)
Need more help?
Want more options?
Explore subscription benefits, browse training courses, learn how to secure your device, and more.
Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.
Logic Functions in Excel check the data and return the result «TRUE» if the condition is true, and «FALSE» if not.
Consider the syntax of logic functions and examples of their application in the process of working with the Excel program.
Logical functions in Excel and examples of solving the problems
Objective 1. It is necessary to overestimate the trade balances. If he product is kept in stock for more than 8 months we should reduce its price 2 times.
We form a table with initial parameters:
To solve the problem, use the logical IF function. The formula will have a look like this: =IF(C2>=8;B2/2;B2)
Logical expression «C2>=8» is constructed using relational operators «>» and «=». The result of his calculations is a logical value of «TRUE» or «FALSE». In the first case, the function returns the value «B2/2». In the second it’s «B2».
Let’s complicate the task — to employ the logic function И. Now we have such a condition: if the product is stored for more than 8 months, the price is reduced 2 times. If it’s more than 5 months, but less than 8, it’s 1.5 times.
The formula takes the following form:
The use of logic functions in Excel:
Function Name | Value | Syntax | Note |
TRUE | It does not have arguments, it returns the logical value » TRUE « | TRUE | It is rarely used as an independent function |
FALSE | It does not have arguments, it returns the logical value » FALSE « | FALSE | ——-//——- |
AND | If all the given arguments return true result, then the function issues a logical expression » TRUE «. If one of the function outputs the result «false» the whole function gives the result «FALSE» | =AND(boolean1;boolean2;…) | Accepts up to 255 arguments in the form of conditions or links. It is mandatory to first. |
OR | It displays the result “TRUE“ if at least one of the arguments is true. | =OR(boolean1;boolean2;…) | ——-//——- |
NOT | It changes the logic value “TRUE on the contrary — » FALSE «. And vice versa. | #NAME? | Usually it is combined with other operators. |
IF | Test the validity of a logical expression and returns the result | =IF (boolean;value_if_TRUE;value_if_FALSE) | « boolean » in the calculations should have results “ TRUE “ or “ FALSE “ |
IFERROR | If the first argument is true, it returns its argument. Otherwise it’s the value of the second argument. | = IFERROR(value;”error”) | Both arguments are mandatory. |
The function IF can be used as arguments to the text values
Objective 2. If the value of the goods in the warehouse after the write-down was less than 300 r. or the product is stored for longer than 10 months, it is written off.
For the solution use logic functions IF and OR:
Condition recorded using a logical OR operation, stands as follows: goods are deducted if the number in cell D2 = 10.
In terms of non-compliance with the conditions, IF function returns to an empty cell.
As arguments, you can use other functions. These are mathematical, for example.
Objective 3. Students before entering the gymnasium pass math, English and Russian. Passing Score is 12. You should get at least 4 points in mathematics for admission. Create report on the receipt.
We set up a table with the source data:
It is necessary to compare the total number of points with a passing grade. And check that math score was not lower than «4». In the «result» column put «accepted» or «not accepted».
There’s such a formula:
Logical operator «AND» causes the function to check the validity of the two conditions. The mathematical function «SUM» is used to calculate the final score.
The function IF allows us to solve many problems; it is therefore used more often.
The statistical and logical functions in Excel
Task 1. Analyze the cost of cash balances after the devaluation. If the price of the product after reassessment is below average values, we should write off the product from the warehouse.
Working with the table in the previous section:
To solve the problem use the formula of such a form:
In logical terms «D2<AVERAGE (D2:D7)» apply statistical function AVERAGE. It returns the average of the range D2: D7.
Task 2. Find the average sales in stores.
We set up a table with the source data:
You need to find the arithmetic meaning for the cells, which value corresponds to a predetermined condition. That is to combine logical and statistical solution.
Below a table with a condition there’s the table to display the results.
We solve the problem with a single function:
The first argument $B$2:$B$7 is a range of cells for testing. The second argument B9 is a condition. The third argument the $C$2:$C$7 is an averaging range; the numerical values, which are taken to calculate the arithmetic mean.
AVERAGEIF function compares the value of B9 cells (№1) with values in the range B2: B7. That is the number of stores in the sales table. For matching the data considers the arithmetic mean of using numbers in the range C2: C7.
Task 3. Find the average sales in the store №1 New York and №2 Los Angeles.
Modify the table from the previous example:
It is necessary to fulfill two conditions — use the function of the form:
Download examples logical functions
The function AVERAGEIFS allows you to use more than one condition. The first argument $D$2:$D$7 is an averaging ranges (where are the numbers to find the arithmetic mean). The second argument $B$2:$B$7 is a range to test the first condition. The third argument B9 is the first condition. The fourth and fifth arguments are the ranges for checking the second condition respectively.
The function takes into account only the values that meet all these criteria.
Use the IF function, one of the logical functions, to return one value if a condition is true and another value if it’s false. For example: =IF(A2>B2,”Over Budget”,”OK”) =IF(A2=B2,B4-A4,””)
Syntax.
Argument name | Description |
---|---|
logical_test (required) | The condition you want to test. |
Contents
- 1 What is logical function example?
- 2 What is the main logical function in Excel?
- 3 How do you write an IF THEN statement?
- 4 Is VLOOKUP a logical function?
- 5 What are logical functions in Excel 2010?
- 6 What is logical function?
- 7 How do I use an IF function in Excel?
- 8 How do you do multiple logic in Excel?
- 9 How is a logical test used in an IF formula?
- 10 How do you write an IF and then formula in Excel?
- 11 Can you nest VLOOKUPs?
- 12 What is ISNA?
- 13 What is an Xlookup in Excel?
- 14 What is logical calculation?
- 15 Can IF statement have 2 conditions?
- 16 How do I write a conditional formula in Excel?
- 17 What are the 3 arguments of the IF function?
- 18 How does a VLOOKUP work?
- 19 How do I do a VLOOKUP with two criteria?
- 20 How many IF functions can be nested in Excel?
What is logical function example?
A logical test is used in logical functions to evaluate the contents of a cell location. The results of the logical test can be either true or false. For example, the logical test C7 = 25 (read as “if the value in cell C7 is equal to 25”) can be either true or false depending on the value that is entered into cell C7.
What is the main logical function in Excel?
IF function
The IF function is the main logical function in Excel and is, therefore, the one to understand first. It will appear numerous times throughout this article. Let’s have a look at the structure of the IF function, and then see some examples of its use. logical_test: This is the condition for the function to check.
How do you write an IF THEN statement?
Another way to define a conditional statement is to say, “If this happens, then that will happen.” The hypothesis is the first, or “if,” part of a conditional statement. The conclusion is the second, or “then,” part of a conditional statement. The conclusion is the result of a hypothesis.
Is VLOOKUP a logical function?
VLOOKUP is a powerful function to perform lookup in Excel. It performs a row-wise lookup until a match is found. The IF function performs a logical test and returns one value for a TRUE result, and another for a FALSE result.
What are logical functions in Excel 2010?
Excel 2010 uses seven logical functions — AND, FALSE, IF, IFERROR, NOT, OR, and TRUE — which appear on the Logical command button’s drop-down menu on the Formulas tab of the Ribbon. All the logical functions return either the logical TRUE or logical FALSE when their functions are evaluated.
What is logical function?
Logical functions are used in spreadsheets to test whether a situation is true or false. Depending on the result of that test, you can then elect to do one thing or another. These decisions can be used to display information, perform different calculations, or to perform further tests.
How do I use an IF function in Excel?
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)
How do you do multiple logic in Excel?
It is possible to nest multiple IF functions within one Excel formula. You can nest up to 7 IF functions to create a complex IF THEN ELSE statement. TIP: If you have Excel 2016, try the new IFS function instead of nesting multiple IF functions.
How is a logical test used in an IF formula?
The IF function runs a logical test and returns one value for a TRUE result, and another for a FALSE result. For example, to “pass” scores above 70: =IF(A1>70,”Pass”,”Fail”).The IF function can be combined with logical functions like AND and OR to extend the logical test.
How do you write an IF and then formula in Excel?
The syntax of IF-THEN is =IF(logic test,value if true,value if false). The first argument tells the function what to do if the comparison is true. The second argument tells the function what to do if the comparison is false.
Can you nest VLOOKUPs?
The VLOOKUP function will throw an #N/A error when a value isn’t found. By nesting multiple VLOOKUPs inside the IFERROR function, the formula allows for sequential lookups. If the first VLOOKUP fails, IFERROR catches the error and runs another VLOOKUP.
What is ISNA?
The ISNA function is a type of error handling function in Excel. It helps to find out whether any cell has “#N/A error” or not. This function returns the value “true” if “#N/A error” is identified. It returns “false” if there is any value other than “#N/A error.”
What is an Xlookup in Excel?
Use the XLOOKUP function to find things in a table or range by row.With XLOOKUP, you can look in one column for a search term, and return a result from the same row in another column, regardless of which side the return column is on.
What is logical calculation?
Logical calculations allow you to determine if a certain condition is true or false (boolean logic). For example, you might want to quickly see if sales for each country you distribute your merchandise to were above or below a certain threshold.
Can IF statement have 2 conditions?
Use two if statements if both if statement conditions could be true at the same time. In this example, both conditions can be true. You can pass and do great at the same time. Use an if/else statement if the two conditions are mutually exclusive meaning if one condition is true the other condition must be false.
How do I write a conditional formula in Excel?
You can create a formula-based conditional formatting rule in four easy steps:
- Select the cells you want to format.
- Create a conditional formatting rule, and select the Formula option.
- Enter a formula that returns TRUE or FALSE.
- Set formatting options and save the rule.
What are the 3 arguments of the IF function?
There are 3 parts (arguments) to the IF function:
- TEST something, such as the value in a cell.
- Specify what should happen if the test result is TRUE.
- Specify what should happen if the test result is FALSE.
How does a VLOOKUP work?
The VLOOKUP function performs a vertical lookup by searching for a value in the first column of a table and returning the value in the same row in the index_number position.As a worksheet function, the VLOOKUP function can be entered as part of a formula in a cell of a worksheet.
How do I do a VLOOKUP with two criteria?
VLOOKUP with Multiple Criteria – Using a Helper Column
- Insert a Helper Column between column B and C.
- Use the following formula in the helper column:=A2&”|”&B2.
- Use the following formula in G3 =VLOOKUP($F3&”|”&G$2,$C$2:$D$19,2,0)
- Copy for all the cells.
How many IF functions can be nested in Excel?
While Excel will allow you to nest up to 64 different IF functions, it’s not at all advisable to do so.
Things will not always be the way we want them to be. The unexpected can happen. For example, let’s say you have to divide numbers. Trying to divide any number by zero (0) gives an error. Logical functions come in handy such cases. In this tutorial, we are going to cover the following topics.
In this tutorial, we are going to cover the following topics.
- What is a Logical Function?
- IF function example
- Excel Logic functions explained
- Nested IF functions
What is a Logical Function?
It is a feature that allows us to introduce decision-making when executing formulas and functions. Functions are used to;
- Check if a condition is true or false
- Combine multiple conditions together
What is a condition and why does it matter?
A condition is an expression that either evaluates to true or false. The expression could be a function that determines if the value entered in a cell is of numeric or text data type, if a value is greater than, equal to or less than a specified value, etc.
IF Function example
We will work with the home supplies budget from this tutorial. We will use the IF function to determine if an item is expensive or not. We will assume that items with a value greater than 6,000 are expensive. Those that are less than 6,000 are less expensive. The following image shows us the dataset that we will work with.
- Put the cursor focus in cell F4
- Enter the following formula that uses the IF function
=IF(E4<6000,”Yes”,”No”)
HERE,
- “=IF(…)” calls the IF functions
- “E4<6000” is the condition that the IF function evaluates. It checks the value of cell address E4 (subtotal) is less than 6,000
- “Yes” this is the value that the function will display if the value of E4 is less than 6,000
-
“No” this is the value that the function will display if the value of E4 is greater than 6,000
When you are done press the enter key
You will get the following results
Excel Logic functions explained
The following table shows all of the logical functions in Excel
S/N | FUNCTION | CATEGORY | DESCRIPTION | USAGE |
---|---|---|---|---|
01 | AND | Logical | Checks multiple conditions and returns true if they all the conditions evaluate to true. | =AND(1 > 0,ISNUMBER(1)) The above function returns TRUE because both Condition is True. |
02 | FALSE | Logical | Returns the logical value FALSE. It is used to compare the results of a condition or function that either returns true or false | FALSE() |
03 | IF | Logical |
Verifies whether a condition is met or not. If the condition is met, it returns true. If the condition is not met, it returns false. =IF(logical_test,[value_if_true],[value_if_false]) |
=IF(ISNUMBER(22),”Yes”, “No”) 22 is Number so that it return Yes. |
04 | IFERROR | Logical | Returns the expression value if no error occurs. If an error occurs, it returns the error value | =IFERROR(5/0,”Divide by zero error”) |
05 | IFNA | Logical | Returns value if #N/A error does not occur. If #N/A error occurs, it returns NA value. #N/A error means a value if not available to a formula or function. |
=IFNA(D6*E6,0) N.B the above formula returns zero if both or either D6 or E6 is/are empty |
06 | NOT | Logical | Returns true if the condition is false and returns false if condition is true |
=NOT(ISTEXT(0)) N.B. the above function returns true. This is because ISTEXT(0) returns false and NOT function converts false to TRUE |
07 | OR | Logical | Used when evaluating multiple conditions. Returns true if any or all of the conditions are true. Returns false if all of the conditions are false |
=OR(D8=”admin”,E8=”cashier”) N.B. the above function returns true if either or both D8 and E8 admin or cashier |
08 | TRUE | Logical | Returns the logical value TRUE. It is used to compare the results of a condition or function that either returns true or false | TRUE() |
A nested IF function is an IF function within another IF function. Nested if statements come in handy when we have to work with more than two conditions. Let’s say we want to develop a simple program that checks the day of the week. If the day is Saturday we want to display “party well”, if it’s Sunday we want to display “time to rest”, and if it’s any day from Monday to Friday we want to display, remember to complete your to do list.
A nested if function can help us to implement the above example. The following flowchart shows how the nested IF function will be implemented.
The formula for the above flowchart is as follows
=IF(B1=”Sunday”,”time to rest”,IF(B1=”Saturday”,”party well”,”to do list”))
HERE,
- “=IF(….)” is the main if function
- “=IF(…,IF(….))” the second IF function is the nested one. It provides further evaluation if the main IF function returned false.
Practical example
Create a new workbook and enter the data as shown below
- Enter the following formula
=IF(B1=”Sunday”,”time to rest”,IF(B1=”Saturday”,”party well”,”to do list”))
- Enter Saturday in cell address B1
- You will get the following results
Download the Excel file used in Tutorial
Summary
Logical functions are used to introduce decision-making when evaluating formulas and functions in Excel.
Excel Logical Functions (Table of Contents)
- Introduction to Logical Functions in Excel
- Types of Logical Functions in Excel
Introduction to Logical Functions in Excel
Logical functions in Excel work with conditions. They help deal with different situations accordingly. These functions perform work similar to IF-ELSEIF-ELSE statements in a programming language. All of these functions have simple syntaxes, and they can be beautifully combined with other functions to obtain desired results. There are various types of logical functions, some of which are commonly used in data operations in Excel.
Types of Logical Functions in Excel
The various types of logical functions in Excel are IF, IFERROR, AND, OR, NOT, TRUE, and FALSE. In the following section, we will see how to use each of them through examples.
You can download this Logical Functions Excel Template here – Logical Functions Excel Template
1. IF
It is a very simple logical function that checks if the condition to be validated as true or false. We will demonstrate the use of the IF function using a very simple example. There’s a simple dataset containing data of students and their marks. Now, if the passing marks are 40, then we would like to declare the result for each student in terms of PASS and FAIL. This can be done using the IF function.
Syntax:
Example:
Step 1: When we enter the IF function, Excel automatically pops up the list of arguments, as shown in the following screenshot.
Step 2: The first argument is the logical test. In this case, the condition is that if marks are more than 40, then the result is PASS, or else it is FAIL. We passed the condition as the argument in the IF function as shown below.
Step 3: The second and third arguments are ‘value_if_true’ and ‘value_if_false’, respectively. If marks are greater than 40, then the result should be PASS; otherwise, FAIL. This has been accomplished by passing the arguments as shown in the following screenshot.
Step 4: Copy the IF function across all the required cells, and we are returned the correct result as shown in the following screenshot.
2. IFERROR
This function is used when we want to return some meaningful result in place of an error. There are various types of errors in Excel, and IFERROR is used to deal with these errors. At many times, in Excel, we are returned error values as results. In such cases, the IFERROR function becomes handy.
Syntax:
As we can see in the syntax, the IFERROR function basically means that if the value passed into it is not an error value, then that value will be given as output by the function; otherwise, the value that we have specified in ‘value if error’ argument.
Step 1: The IFERROR function takes into consideration two arguments as seen in the syntax. This is also shown in the screenshot below.
Step 2: In this example, we have marks for certain students. For some of the students, the result is not available, and for them, we have a #N/A error in the Marks column. We want this error value to be replaced with some meaningful text which is possible through the use of IFERROR. The following screenshot shows this.
As we can see in the above screenshot, we passed marks as the first argument and kept the string “Not Available” as the second argument. It means if marks are valid, then output marks or else “Not Available”. This is as shown by the following screenshot.
3. AND
This function returns either TRUE or FALSE value by checking the conditions that are passed into it. If all the conditions passed into AND function are met, then the TRUE value is returned, and if even a single condition is not met, then the FALSE value is returned.
Syntax:
Step 1: We have marks for three different subjects for certain students. Now, we want to check if the student has passed or failed. If a student secures marks less than 40 even in a single subject out of the three subjects, he has failed in the examination. We can determine the result for each student using the AND function. When we enter the AND function, we find that arguments are highlighted. In this case, they are logical conditions, as shown below.
Step 2: Using AND, we will get results for each student by passing the conditions in the function as shown below.
When the function is implemented, we get the result as shown below. Note, here, TRUE means pass, and FALSE means fail.
4. OR
It returns TRUE value even if a single condition out of the total conditions passed into it is met. It returns FALSE when all the arguments are FALSE.
Syntax:
Step 1: We have marks for three different subjects for certain students. Now, if a student has secured 40 marks in at least one of the three subjects, then the result should be pass or else fail. When we enter the OR function, the arguments are highlighted as below.
Step 2: The desired criteria for determining a student’s result can be met using the OR function as shown below.
When the above step is followed, we get the desired result, as shown below. Observe it.
5. NOT
It reverses the logical value, i.e. TRUE to FALSE and FALSE to TRUE. It is implemented usually in context-based situations.
Syntax: NOT(logical)
Step 1: We pass certain logical conditions into NOT and check how the function works. Have a look at the following screenshot.
The actual result for each of them is shown. However, the logical values are reversed when we pass the logical conditions into the NOT function, as shown below.
6. TRUE and FALSE
They return corresponding logical values; TRUE returns TRUE while FALSE returns FALSE.
Syntax: TRUE(), FALSE()
We have the result of students. For PASS, we will display TRUE and for FAIL, FALSE. The following screenshot shows the implementation.
The result that we obtain is as shown below.
Things to Remember
- The logical functions should be implemented in various contexts to understand their full capability.
- The difference in available features in logical functions for different versions of Excel should be checked.
- Each of the argument in a logical function should be studied in order to understand its role and significance.
Recommended Articles
This has been a guide to Logical Functions in Excel. Here we discuss How to use Logical Functions in Excel along with practical examples and a downloadable excel template. You can also go through our other suggested articles –
- Excel Logical Test
- Excel IF AND Function
- AND Function in Excel
- Excel SUMIF with OR