Excel Functions – Logical


Excel FunctionDescription
Excel AND Function

Excel AND function can be used when you want to check multiple conditions. It returns TRUE only when all the given conditions are true.

Input Arguments

logical1 – the first condition that you want to evaluate for TRUE or FALSE.

[logical2] – (Optional) This is the second condition that you want to evaluate for TRUE or FALSE.

Additional Notes

AND function can be used with other formulas to be more efficient.

For example, in an IF Function, you can test a condition and then specify a value when it’s TRUE and a value when it is FALSE. Using AND function within IF enables users to test multiple conditions at one go.

For example, if you have to test whether if A1 is greater than 0 and less than 100, here is how you can do it in an IF function:

=IF(AND(A1>0,A1<100),”Approve”,”Reject”)

The arguments must either evaluate to logical values (TRUE/FALSE), or the arguments must be arrays/references of logical values.

Text and empty cells are ignored.

If the specified range contains no logical values, the AND function returns #VALUE! error.

Excel FALSE Function

Excel FALSE function returns the logical value FALSE. It does not take any input arguments.

FALSE function is best used when you are evaluating a condition, and if isn’t TRUE, you simply want to get the FALSE value in the cell. For example:

=IF(AND(A1>0,A1<100),”Approve”,FALSE())

In this example, if the condition is not met, it simply returns FALSE as the result.

If you type FALSE (without parenthesis) in a formula or in a cell, excel automatically takes it as the FALSE logical value.

FALSE and FALSE() both would return the same value.

In terms of value, a FALSE is a 0 and a TRUE is a 1. These can be used in calculations

For example: =FALSE+FALSE would be 0 and =FALSE+TRUE would be 1.

Excel IF Function

Excel IF Function is best suited for situations where you want to evaluate a condition, and the return a value if it is TRUE and another value if it is FALSE.

Input Arguments

logical_test – this is the condition that you want to test. It could be a logical expression that can evaluate to TRUE or FALSE. This can either be a cell reference, a result of some other formula, or can be manually entered.

[value_if_true] – (Optional) This is the value that is returned when the logical_test evaluates to TRUE.

[value_if_false] – (Optional) This is the value that is returned when the logical_test evaluates to FALSE.

A maximum of 64 nested IF conditions can be tested in the formula.

If any of the argument is an array, each element of the array is evaluated.

If you omit the FALSE argument (value_if_false), i.e., there is only a comma after the  value_if_true argument, the function would return a 0 when the condition is FALSE.

For example, in the example below, the formula is =IF(A1>20,”Approve”,), where the value_if_false is not specified, however, the value_if_true argument is still followed by a comma. This would return 0 whenever the checked condition is not met.Excel If Function - When False is ommitted

If you omit the TRUE argument (value_if_true), and specify only the value_if_false argument, the function would return a 0 when the condition is TRUE.

For example, in the example below, the formula is =IF(A1>20,,”Approve”), where the value_if_true is not specified (only a comma is used to then specify the value_if_false value). This would return 0 whenever the checked condition is met.

Excel IFS Function

Excel IFS Function is best suited for situations where you want to test multiple conditions at once and then return the result based on it. This is helpful as you don’t have to create long nested IF formulas that can get confusing.

=IFS(Condition1, Value1, [Condition2, Value2],…[Condition127, Value127])

Condition1 – The first condition that is checked.

Value1 – The value to return if the first condition is TRUE.

[Condition2….Condition127] – These are optional arguments, and you can use up to 127 conditions in the IFS function.

[Value2….Value127] – These are optional arguments, and you can use up to 127 values. Each value corresponds to its condition and would be returned if it’s condition is the first one to be TRUE.

Remember that the IFS function would return the value of the first TRUE condition only. So you can have multiple conditions that are TRUE. However, only the value for the first one would be returned.

Excel IFERROR FunctionExcel IFERROR function is best-suited to handle formula that evaluates to an error. You can specify a value to show if the formula returns an error.


Excel NOT Function

Excel NOT function can be used when you want to reverse the value of a logical argument (TRUE/FALSE).

Input Arguments

logical – A value or expression that can be evaluated to TRUE or FALSE.

Additional Notes:

You can check expression with NOT function that evaluates to TRUE or FALSE.

For example, =NOT(1+1=2) would return FALSE.

Excel OR FunctionExcel OR function can be used when you want to check multiple conditions. It returns TRUE if any of the given condition is true.

Input Argumentslogical1 – the first condition that you want to evaluate for TRUE or FALSE.[logical2] – (Optional) This is the second condition that you want to evaluate for TRUE or FALSE.Additional NotesOR function can be used with other formulas to be more efficient.For example, in an IF Function, you can test a condition and then specify a value when it’s TRUE and a value when it is FALSE. Using OR function within IF enables users to test multiple conditions at one go.For example, if you have to test whether if A1 is greater than 0 or less than 100, here is how you can do it in an IF function:=IF(OR(A1>100,A1<0),”Approve”,”Reject”)The arguments must either evaluate to logical values (TRUE/FALSE), or the arguments must be arrays/references of logical values.Text and empty cells are ignored.
Excel TRUE Function

Excel TRUE function returns the logical value TRUE. It does not take any input arguments.

TRUE function is best used when you are evaluating a condition, and if is TRUE, you simply want to get the TRUE value in the cell. For example:

=IF(AND(A1>0,A1<100),TRUE(),”Reject”)

In this example, if the condition is not met, it simply returns TRUE as the result.

If you type TRUE (without parenthesis) in a formula or in a cell, excel automatically takes it as the TRUE logical value.

TRUE and TRUE() both would return the same value.

In terms of value, a FALSE is a 0 and a TRUE is a 1. These can be used in calculations.

For example: =TRUE+TRUE would be 2 and =FALSE+TRUE would be 1

According to Microsoft Help, Excel TRUE function is provided primarily for compatibility with other spreadsheet programs.

Comments

Best Blogs

IB Interview Questions: M&A : Level 1 M&A Questions

Getting into Investment Banking: A Comprehensive Guide