Create conditional formulas Using IF

Testing whether conditions are true or false and making logical comparisons between expressions are common to many tasks. You can use the AND, OR, NOT, and IF function to create conditional formulas.
The IF function uses the following arguments.

Formula with the IF function

Callout 1 logical_test: The condition that you want to check.
Callout 2 value_if_true: The value to return if the condition is true.
Callout 3 value_if_false: The value to return if the condition is false.
Example:
FormulaDescription
=AND(A1>A2, A1<A3) Is 15 greater than 9 and less than 8? (FALSE)
=OR(A1>A2, A1<A3) Is 15 greater than 9 or less than 8? (TRUE)
=NOT(A1+A2=24) Is 15 plus 9 not equal to 24? (FALSE)
=NOT(A4=”Black”) Is A4 not equal to “Black”? (FALSE)
=OR(A5<>”Black”,A6 = “Red”) Is A5 not equal to “Black” or A6 equal to “Red”? (TRUE)
Function “AND”:

Returns TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE.

Syntax

AND(logical1,logical2, …)

Logical1, logical2, …     are 1 to 30 conditions you want to test that can be either TRUE or FALSE.

Remarks

  • The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be 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, AND returns the #VALUE! error value.
A B
Formula Description (Result)
=AND(TRUE, TRUE) All arguments are TRUE (TRUE)
=AND(TRUE, FALSE) One argument is FALSE (FALSE)
=AND(2+2=4, 2+3=5) All arguments evaluate to TRUE (TRUE)
Function “OR”:
Returns TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.

Syntax

OR(logical1,logical2,…)

Logical1,logical2,…     are 1 to 30 conditions you want to test that can be either TRUE or FALSE.

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.
Formula Description (Result)
=OR(TRUE) One argument is TRUE (TRUE)
=OR(1+1=1,2+2=5) All arguments evaluate to FALSE (FALSE)
=OR(TRUE,FALSE,TRUE) At least one argument is TRUE (TRUE)
0

About the author

Janaki(http://mjanaki.com) - A Software developer with 9+ years of experience in multiple technology projects across web, mobile, and cloud applications with expertise in PHP, C#, MySQL, Web services and open source platforms.

Similar Posts

Excel worksheet functions by category

Leave a reply

required*

Eye Test: * Time limit is exhausted. Please reload CAPTCHA.