Watch the video

How to make "if" in Excel?

Before proceeding to the consideration of syntaxfunction "if", we define its purpose. It is known from English language lessons that "if" means "if", and from the lessons of computer science "if" (IF) is a logical function of the condition: IF condition 1 is fulfilled, then TRUE, otherwise - FALSE. Condition 1 implies some logical expression (for example, a comparison), TRUE means that the condition is true. As a result of the condition, some mathematical expression may appear.

For an understanding, let us consider an example of prices in a movie theater. It is known that most sessions in the morning hours (say, up to 12 hours) are cheaper than in the daytime (up to 22 hours), and those in turn are cheaper than evening (up to 24 hours). Since we have 3 possible conditions (up to 12, up to 20 and up to 24), then we have a branching algorithm (nested if loop):

  • IF to 12, then 100 rubles., AKA
    • IF up to 20, then 200 rubles.
      • Otherwise 250 rubles.

Use of this function is useful, in the first placeturn, mathematicians, accountants and financiers (for calculating wages, calculating loans, etc.). It is most simple to implement it in MS Office Excel, since "excel" is the most common spreadsheet program in the Windows operating system, and the syntax is the same for all versions (from 97 to 2012).

How to make "if" in Excel?

To use the function, you need to click the left mouse button (LMB) in the free field of the table, put the "=" sign and write "IF". "Excel" will give a pop-up hint in the form:

  • IF (log_expression; [value_if_true]; [value_if_long]

To select this expression, click on it 2 times LMC.

The fields described in square brackets [] are optional.

Consider the example:

Let's have a warehouse of a home appliance store, and among the goods you need to find TV sets of the Russian assembly costing up to 15 000 rubles.

The table has 4 columns: the column A-name of the product, B - the producer country, C - the price for the goods, D - the marks about the desired product.

In order to fulfill our 3 conditions (TV and Russia and Up to 15,000 rubles), you need to write the following expression in the free field (D2-second row of column D):

  • = IF (AND (A2 = "TV"; B2 = "Russia"; C2 <15000); "+";)


a country

Price, rub

TV Russia 10000 +
fridge Germany 10000 0
kettle Poland 2000 0
fridge Russia 18000 0
TV Russia 160000 0
kettle Russia 1000 0
toaster Hungary 1500 0
TV China 12000 0
fridge Russia 19000 0
kettle China 1800 0
fridge Belarus 10500 0
toaster China 2000 0
kettle China 2500 0
TV Russia 14800 +
fridge Germany 25000 0

Knowing how the "if" function works, you can create nested loops to solve more complex tasks and multiple condition checks.

Related news

How to make if in Excel How to make if in Excel How to make if in Excel How to make if in Excel How to make if in Excel How to make if in Excel How to make if in Excel How to make if in Excel How to make if in Excel How to make if in Excel