Saturday, July 12, 2008

Excel: If Function


In Excel, the If function returns one value if a specified condition evaluates to TRUE, or another value if it evaluates to FALSE. The syntax for the If function is: If( condition, value_if_true, value_if_false ) condition is the value that you want to test. value_if_true is the value that is returned if condition evaluates to TRUE. value_if_false is the value that is return if condition evaluates to FALSE. For example: Let's take a look at an example:



Based on the Excel spreadsheet above:

=If(A1>10, "Larger", "Smaller")

would return "Larger".

=If(A1=20, "Equal", "Not Equal")

would return "Not Equal".

=If(A2="Tech on the Net", 12, 0)

would return 12.

Learn how to nest multiple If Functions. (up to 7)

Learn how to nest multiple If Functions. (more than 7)

Frequently Asked Questions


Question: In Excel, I'd like to use the If function to create the following logic:

if C11>=620, and C10="F"or"S", and C4<=$1,000,000, and C4<=$500,000, and C7<=85%, and C8<=90%, and C12<=50, and C14<=2, and C15="OO", and C16="N", and C19<=48, and C21="Y", then reference cell A148 on Sheet2. Otherwise, return an empty string.

Answer: The following formula would accomplish what you are trying to do:

=IF(AND(C11>=620, OR(C10="F",C10="S"), C4<=1000000, C4<=500000, C7<=0.85, C8<=0.9, C12<=50, C14<=2, C15="OO", C16="N", C19<=48, C21="Y"), Sheet2!A148, "")