logical_test: This is the condition that you want to test (required). value_if_true: The value you want returned if logical_test is true (required). value_if_false: The value you want returned if logical_test is not true (optional).
In this example, the condition is B3>C3, meaning “If the value of B3 is greater than C3. " If the value of B3 is greater than C3, then Goal Met will appear in the cell. If the value of B3 is less than the value of C3, then Goal Not Met will appear in the cell.
In this example, the condition is B3=C3, meaning, “If the value of B3 is equal to the value of C3. " If the values are equal, “Goal Met” will appear in the cell. If the values are not equal, a zero will appear in the field because we did not define a third (ELSE) value. [1] X Trustworthy Source Microsoft Support Technical support and product information from Microsoft. Go to source
In this example the condition is B32>C3, meaning “If the value of B3 multiplied by 2 is greater than the value of C3. " If the value of B32 is greater than the value of C3, the value of C3 multiplied by 400 will appear in this cell. If the value of B3*2 is not greater than the value of C3, the word “Good” will appear in the cell.
In this example, the condition is B3=“Sold”, meaning “If the value of cell B3 contains the word Sold. " If B3 contains the word “Sold,” a “1” will appear in the cell. If B3 says anything other than the word “Sold,” the condition is false. Since our ELSE value is " “, which is two double quote marks with nothing in between, the cell value will be blank.
In this example, the condition is D3=“Taxed”, meaning “If the value of D3 is the word Taxed. " If D3 contains the word “Taxed,” the result will be the value of F3 multiplied by . 07. If D3 contains anything other than the word “Taxed,” the result will be 0.
An IF statement can have two different results—one result if the condition is true, and another result if the condition is false. The ELSE value, which is what will happen if the result is false, is optional—if you don’t specify what to place in the cell if the condition is false, a “0” will appear in the cell. If you’d rather the cell be blank, make your ELSE value “”. When referring to specific text in a condition or THEN/ELSE value, always surround that text in quotation marks.
=IF(F1=“Alaska”, G10,IF(F1=“California”,G10. 0725,IF(F1=“Oregon”,G10,IF(F1=“Washington”, G10. 065))))
A good alternative to IF/THEN statements in this situation would be to add the values to a single table and use a VLOOKUP formula to query the table for the proper rates. For example, if we add a list of our states to column A and their corresponding tax rates in column B, we could write a VLOOKUP formula that does the math for us without specifying the amounts in the formula itself. The shortened version of the above nested IF/THEN formula would be =G1*VLOOKUP(F1,A:B,2,TRUE). If you had to update a tax rate, you’d now only have to update it in the referenced table, not all of your formulas.
If you don’t specify a value_if_false value, the result will always be 0 if the condition is false.
For example, this IF/THEN statement will result in the #NAME? error because there are no quotation marks around the value OK: =IF(A2>1,OK). The correct syntax would be =IF(A2>1,“OK”)