IF operate – Microsoft Assist

The IF operate is without doubt one of the hottest capabilities in Excel, and it permits you to make logical comparisons between a price and what you anticipate.

So an IF assertion can have two outcomes. The primary result’s in case your comparability is True, the second in case your comparability is False.

For instance, =IF(C2=”Sure”,1,2) says IF(C2 = Sure, then return a 1, in any other case return a 2).

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

Use the IF operate, one of many logical capabilities, to return one worth if a situation is true and one other worth if it is false.

IF(logical_test, value_if_true, [value_if_false])

For instance:

Argument title

Description

logical_test    (required)

The situation you need to take a look at.

value_if_true    (required)

The worth that you really want returned if the results of logical_test is TRUE.

value_if_false    (non-obligatory)

The worth that you really want returned if the results of logical_test is FALSE.

Easy IF examples

Cell D2 contains a formula =IF(C2=

Within the above instance, cell D2 says: IF(C2 = Sure, then return a 1, in any other case return a 2)

Cell D2 contains the formula =IF(C2=1,

On this instance, the formulation in cell D2 says: IF(C2 = 1, then return Sure, in any other case return No)As you see, the IF operate can be utilized to judge each textual content and values. It can be used to consider errors. You aren’t restricted to solely checking if one factor is the same as one other and returning a single end result, you can too use mathematical operators and carry out further calculations relying in your standards. You may as well nest a number of IF capabilities collectively to be able to carry out a number of comparisons.

Formula in cell D2 is =IF(C2>B2,”Over Price range”,”Inside Price range”)” />                        </p>
<p>Within the above instance, the IF operate in D2 is saying <i>IF(C2 Is Larger Than B2, then return “Over Price range”, in any other case return “Inside Price range”)</i></p>
<p>            <img decoding=

On this instance, the formulation in F7 is saying IF(E7 = “Sure”, then calculate the Complete Quantity in F5 * 8.25%, in any other case no Gross sales Tax is due so return 0)

Be aware: If you will use textual content in formulation, you could wrap the textual content in quotes (e.g. “Textual content”). The one exception to that’s utilizing TRUE or FALSE, which Excel mechanically understands.

Frequent issues

Downside

What went unsuitable

0 (zero) in cell

There was no argument for both value_if_true or value_if_False arguments. To see the fitting worth returned, add argument textual content to the 2 arguments, or add TRUE or FALSE to the argument.

#NAME? in cell

This often signifies that the formulation is misspelled.

Want extra assist?

You may all the time ask an skilled within the Excel Tech Group or get assist in Communities.

See Additionally

IF operate – nested formulation and avoiding pitfalls

IFS operate

Utilizing IF with AND, OR and NOT capabilities

COUNTIF operate

Find out how to keep away from damaged formulation

Overview of formulation in Excel

You May Also Like

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다