# How to use the IF function

September 28, 2021
278 Views

### Graphic skills

The IF formula, as one of the most commonly used functions, can determine whether a condition is TRUE or FALSE, so as to get one of the two values. In this article, you will see the explanation of IF function, several examples of IF formula, as well as a case demonstration.

· Explanations of IF formula:

IF(logical_test, value_if_true, [value_if_false])

· logical_test (necessary): the condition to be compared

· value_if_true (necessary): the value to be presented as the result when the “logical_test” is TRUE

· value_if_false (unnecessary): the value to be presented as the result when the “logical_test” is FALSE

In a word, the result would be the first value if the logic is TRUE, and the second value when the logic is FALSE.

· Here are some examples.

 Formula Explanations =IF(C3>B3;YES;NO) When C3>B3, the result would be “YES”, while it would be “NO” if C3 =< B3. =IF(C3>B3;B3-C3) When C3>B3, the result would be the value of B3-C3. Otherwise, the result would be “FALSE” in the corresponding cell. =IF(C2=“Yes”,1,2) When the value in C2 is “Yes”, the target cell will present the result “1”, while it would be “2” when C2 is examined being filled with other values.

Note that if we want to present the result as text contents, quotation marks should be used (e.g. “YES”, “NO”).

· Here is a spreadsheet recording the group sales Performance in January.

Run the IF formula, and we can examine whether or not the groups have reached the monthly goals.

Enter the formula:

=IF(C3>B3;YES;NO)

When C3>B3, the result would be “YES”. Or else, the result would present as “NO”. To be office excel advanced, you could learn how to use WPS Office Spreadsheet online in WPS Academy.