EducationSecondary education and schools

The If function in Excel

Microsoft Excel has a powerful tool that can help you solve difficult computing tasks. One of the most used tools from this set is the "IF" function.

Function Value

When working in Excel, it is necessary to understand the value of the function "IF" in order to construct the correct syntactic queries. Due to its algorithm, a logical comparison is performed, depending on the results of which one of two actions will be performed.

In more simple terms, the function "IF" in the case of the true value of an expression performs one action, in the case of a false one, another. In this case, both the explicit value and a certain function can be used as actions, including "IF". Due to this in Excel, the function "IF" allows branching when performing some algorithm of actions in solving various problems.

The syntax "IF"

A simple description of the majority of syntactic constructions is one of the main advantages that "Excel" is famous for. The function "IF" also refers to their number - after the keyword in parentheses, the condition, the action at the true value, and then the false one are alternately indicated. In a schematic form it looks like this:

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

Nesting

One of the features that distinguishes the function "IF" is nesting. That is, within one design, there may be one more, on the value of which depends also the overall result of the query. In addition to the function itself, within the "IF" there may be others. But in the first case, this component can be located in any of the three parts of the syntactic structure.

Several conditions

When working with complex tasks, the function "IF" with several conditions is used, however, at this stage most users have a problem. This is due to the specific task of the multi-ordering of the algorithm. In Excel, the function "IF" checks only one comparison operation in a logical expression, that is, it will not be possible to use a conjunction or disjunction. To test several conditions, you must use the nesting property.

To understand how to set several conditions in the "IF", it is convenient to use an example. Let's check if the number in cell "A1" is in the given interval - from 5 to 10. As you can see, in this case it is necessary to check two conditions by checking the truth comparison with two values - 5 and 10. To implement this example In "Excel", it is necessary to write the function in the following form:

= IF (A1> 5; IF (A1 <10; "enters the range;" "does not enter the range"); "does not enter the range");

To avoid repeated repetition of the output phrase, it is worthwhile to apply the nesting principle one more time, as arguments, choosing to check the return of the value of the functions, depending on which and output, or at the very beginning use the "AND" function, combining all the conditions in it at once. This approach will complicate the understanding of the written construction with a small level of nesting, but with a significant number of conditions, this approach will be more optimal.

Special function variants

It is worth noting that the function "IF" allows you to leave one or more of your parameters blank. In this case, the results will depend on which arguments were omitted by the user.

If the empty space is left in place of the logical expression, the result of the function will be the execution of the action responsible for the false execution of the algorithm. The reason for this is the fact that the program associates an empty space with zero, which in logical language means "FALSE". If you leave one of the values that are responsible for execution in case of truth or falsehood, then the result will be "0".

Separately, it is worth noting the case when instead of a logical expression, a construct that returns the value "TRUE" or "FALSE" is entered, but some character set or a reference to a cell. In the case when as an argument some expression containing something other than a numerical value or logical words is written, then this will cause an error when the function is executed. If you specify a cell address or write a number / logical value, the result will determine this content. When there is a number 0 in the cell or in the condition, the word "FALSE" or empty, the result is a false function. In all other cases, a true scenario of actions will be executed.

When working with the English version of "Excel" it is necessary to take into account the fact that all functions are also written in English. In this case, the function "IF" will be written as IF, but otherwise the syntactic structure and algorithm will remain the same.

What you should pay attention to

"Excel" allows to use up to 64 nested functions "IF" - this amount is enough to solve almost all tasks, however, even this small number often becomes a problem for the user. There are several reasons for this: when creating a query, it is easy enough to make a mistake with the record of the formula - according to statistics, every slightest inaccuracy in 25% of cases leads to the wrong result, which is a rather large indicator.

Another disadvantage of the large nesting "IF" is low readability. Despite the color highlighting program of some parts of the query, even a few nested functions, it is very difficult to make out. Thus, if after some time you have to return to the design or start working with someone else's request, understanding the record will take a lot of time. In addition, each function has its own pair of parentheses, and accidentally putting it in its place, it will take a long time to look for an error.

Examples

To consolidate understanding, it is worthwhile in practice to consider how the "IF" function works in Excel. The examples below show all the main ways of using it.

The simplest example for parsing the function is to compare two numbers. For the presence of variability, we set the values of two numerical variables in cells A1 and B1, which we will compare with each other. To solve this problem, you should use the following entry:

= IF (A1 = B1; "the numbers are equal", "the numbers are unequal").

In this case, if there are identical values in both cells, the result is the record "the numbers are equal", in all other cases the "numbers are unequal".

To consider the operation of a conditional operator with several conditions, one can use as an example the finding of the number of solutions of the quadratic equation. In this case, the check is made on the discriminant - if it is less than zero, then there is no solution, if it is zero, it is one, in all other cases there are two roots. To write down this condition, it is enough to compose the query as follows:

For those who want to better understand all the possibilities that the "IF" function has, in Excel the examples are in the help section, where the progress of each solution is described in detail.

Similar articles

 

 

 

 

Trending Now

 

 

 

 

Newest

Copyright © 2018 en.atomiyme.com. Theme powered by WordPress.