How to write a sentence with if in English? After all, in Russian we use them every day:

"We'll have a picnic in the park if it's okay." good weather. If she learns English, she will find good job. If you don't hurry up, we'll miss the train."

All these sentences contain a certain condition, if fulfilled or not fulfilled, the action itself will be performed. In English such sentences are called conditional.

There are several types of such offers. In this article I will tell you about conditional sentences of the first type.

In the article you will learn:

  • Rules and schemes for the formation of affirmative sentences

Rules for using the first type of conditional sentences in English

Conditional sentences of the first type (First conditional) are used when we talking about real future events. That is, if the condition is met, then the action will occur in the future.

For example:

If the weather is warm (condition), we will go for a walk (future action).

They will go to the cinema (action in the future) if they leave work early (condition).

Let's look at how to correctly construct such sentences in English.

Rules for the formation of conditional sentences of the first type in English


Conditional sentences consist of 2 parts:

  • main part - an action that will happen in the future
  • conditions - events that must happen

A conditional sentence can begin with either the main part or the condition.

Let's look at the formation of each of these parts.

Main part

The main part contains an action that will happen in the future. Therefore, in this part we use the Future Simple tense, which is formed using the verb will.

When constructing a sentence, we place this verb after the actor performing the action.

Also in this part, instead of will, the following words can be used:

  • shall - must/should
  • should - should
  • would - will
  • can - can
  • could - could
  • may - may/possibly
  • might - perhaps/can

He will go to the shop, …….
He will go to the store, …….

She can open the window, ……
She can open the window......

He should lock a door, ……
He should lock the door......

Conditional part

This part of the sentence contains a certain condition, upon the occurrence or non-occurrence of which the action from the main part will occur.

In this part we use the Present Simple tense (simple present), despite the fact that we translate it into Russian into the future tense.

In this tense, we do not change the verb in any way if the actions are performed: I (I), you (you), they (they), we (we). If the actions are performed by: he (he), she (she), it (it), then we add the ending -s/-es to the verb.

The conditional part begins with the word if, which translates as “if”.

Also, instead of if the following can be used:

  • When - when
  • While - while, while, during
  • Before - before
  • After - after
  • As soon as - as soon as
  • Until (till) - until, until this moment

If I work hard, ……
If I work hard,…….

If he call s me,……
If he calls me.....

If she teach es you,……
If she teaches you,…….

To avoid mistakes, remember: we don't put will after if

By combining the two parts, we get the following scheme for the formation of the first type of conditional sentences:

She will call me if she goes to the cinema.
She will call me if she goes to the cinema.

He will come if you call him.
He will come if you call him.

They will help her if she asks them.
They will help her if she asks.

We can swap the main part and the condition, but the rules for the formation of these parts will not change in any way. Only a comma is added, which now separates the two parts.

If he tries hard, he will succeed.
If he tries, he will succeed.

If they study hard, they will pass an exam.
If they study hard, they will pass the exam.

If she feels well, she will come.
If she feels good, she will come.

Conditional sentences of the first type with negation


In such sentences we can also use negation if:

  • an action will happen provided that something does not happen(negation in part with condition)
    For example: I will arrive on time if I don’t get stuck in traffic.
  • the action will not happen unless something happens(negation in the main part)
    For example: She won't come to the party if she works.
  • the action will not happen unless something happens(negation in both parts)
    For example: They won't come unless you call them.

Let's consider each case.

Negation in the main part

To make the main part negative, we put not after will.

Most often we use the abbreviation: will + not = wont. The outline of such a proposal would be as follows:

They won't go to the gym if they get tired.
They won't go to the gym if they're tired.

She won't sleep, if she prepares for an exam.
She won't sleep if she studies for the exam.

Negation in part with condition

The negation in this part is formed using the auxiliary verb do/does of the Present Simple tense and the negative particle not. We use Do when we say I (I), you (you), they (they), we (we). Does when we say she (she), he (he), it (it).

Here we also use abbreviations:

do + not = don"t
does + not = doesn’t

We place them after the character.

The sentence formation scheme will be:

She will leave if you don't call her.
She will leave if you don't call her.

He will be late if he doesn't hurry.
He'll be late if he doesn't hurry up.

Negation in both parts

Negation can appear in two parts at once. The education scheme will be as follows:

As you can see, in the first part we add not to will, in the second we put don"t/doesn"t after the character.

They won't buy a new car, if they don't sell an old one.
They won't buy a new car unless they sell the old one.

She won't go abroad, if she doesn't find a job.
She won't go abroad unless she finds a job.

Now let's look at how to ask an interrogative sentence with a condition.

Question with conditional sentence of the first type in English

When we ask a question, we find out whether a person will do something under certain conditions or not.

To build a question, we only need to change the main part. To do this, we move will to the first place in the sentence.

The part that contains the condition does not need to be changed.

The outline of such a proposal:

Please note that when we ask a question, the main part always comes first.

Will we go to a park if you finish your work?
Shall we go to the park if you finish work?

Will she get a new job if she learns English?
Will she get a job if she learns English?

Since the question is asked to the main part, then:

  • a short positive answer will contain yes, the agent and will.

Will he take a taxi if he misses a bus? Yes, he will.
He will take a taxi if he misses the bus. Yes, he will.

  • a short negative answer will contain no, actor and won't.

Will they wait for me if I come with them? No,they won't.
Will they wait for me if I go with them? No, they won't wait.

So, in conditional sentences of the first type, the main thing to remember is that in the part with the condition (if), we do not use the future tense (will). Since this mistake is the most common one when studying this topic. To consolidate the composition of such sentences, do a consolidation task.

Reinforcement task

Translate the following sentences into English:

1. If you see Tom, tell him to call me.
2. If I drink coffee, I won't sleep.
3. She will meet me if she doesn't work.
4. He will get a job if he moves.
5. They won't make a cake unless they go to the store.
6. We won't go to the cinema if she comes.

Leave your answers in the comments below the article.

Recording format: =IF (condition; expression B; expression C)

This entry means:

1) if the condition is met, then the action defined in expression B occurs;

2) if the condition is not met, then the action defined in expression C occurs.

Expressions B and C can be a numeric expression, a function, a reference to a table cell or its name, or text enclosed in quotation marks.

Example. Let a number of employees have consumer loan debt, which is reflected in the range SZ:S7 (Fig. 9.2). You need to find such employees on the list and withhold from them 10% of the amount accrued to them to repay the loan.

A IN WITH D E
Full name Accrued, thousand rubles. Loan debt Withheld, thousand rubles.
Consumer Housing
Ivanov =IF(C3>0;B3*0.1;””)
Petrov =IF(C4>0;B4*0.1;””)
Kuzmin =IF(C5>0;B5*0.1;””)
Sukhov =IF(C6>0;B6*0.1;””)
Nikolaev =IF(C7>0;B7*0.1;””)

Rice. 9.2. Example of a simple logical IF function

For our example, the logical function will look like this:

=IF (C3>0; VZ *0.1; " ").

This logical function means the following: if the debt on a consumer loan is greater than zero, then it is necessary to withhold 10% of the accrued amount, otherwise it is necessary to display spaces.

In the range SZ:C7, employees are found who have debt on a consumer loan, and in the range EZ:E7 the amount of the withheld amount is indicated. In cases where there is no debt on a consumer loan, spaces are displayed opposite the names of the relevant employees in the range EZ:E7.

As a result, in the range EZ:E7 (Fig. 9.3), we obtain the amount withheld from employees who have debts on a consumer loan.

Rice. 9 3. The result of executing a simple logical IF function

LOGICAL FUNCTION AND

Logic function AND provides verification of the simultaneous fulfillment of conditions associated with this function. If all conditions are met, the function takes the value TRUE, and if at least one of the conditions is not met, the function takes the value FALSE.

Recording format: AND (condition #1; condition #2)

The result is true if two conditions are true. Otherwise the result is false:

Function AND is part of the function IF, which in this case has the following format:

=IF(AND(cond.#1;cond.#2); expression B; expression C)

Example. Find employees who simultaneously have debts on a consumer loan and a loan for housing construction, and withhold 20% of the amount accrued to them (Fig. 9.4).

A IN WITH D E
Full name Accrued, thousand rubles. Loan debt Withheld, thousand rubles.
Will consume Housing
Ivanov =IF(AND(C3>0;D3>0); B3*0.2;””)
Petrov =IF(AND(C4>0;D4>0); B4*0.2;””)
Kuzmin =IF(AND(C5>0;D5>0); B5*0.2;””)
Sukhov =IF(AND(C6>0;D6>0); B6*0.2;””)
Nikolaev =IF(AND(C7>0;D7>0); B7*0.2;””)

Rice. 9.4. Logical AND function combined with IF function

For our example, the logical function will look like this:

=IF (AND (C3>0;D3>0); B3*0.2; " ")

This logical function means the following: if at the same time the debt on a consumer loan and a loan for housing construction is greater than zero, then it is necessary to withhold 20% of the accrued amount, otherwise it is necessary to display the gaps.

Let's write it in cell E3, and then copy it to cells E4:E7.

In columns C and D (Fig. 9.5) only one employee will be found who has debt on two types of loans. In column E, he will be deducted 20% of the accrued amount. Spaces will appear opposite the rest of the employees in column E.

Fig.9.5. The result of executing a logical AND function in combination with an IF function

LOGICAL FUNCTION OR

Logic function OR provides verification of the fulfillment of at least one condition out of all the conditions associated with this function. In this situation, the function evaluates to TRUE, and if no condition is met, the function evaluates to FALSE.

This function true if at least one of the two conditions included in it is true. Recording format: = OR (condition #1; condition #2)

Only if both conditions are false, the OR function is also false:

This function is used in conjunction with the logical IF function, which in this case has the following format:

=IF(OR(cond.#1;cond.#2); expression B; expression C)

Example. Find employees who have debt either on a consumer loan, or on a housing construction loan, or on both types of loans at once, and withhold from them 10% of the amount accrued to pay off the loan (Fig. 9.6).

A IN WITH D E
Full name Accrued, thousand rubles. Loan debt Withheld, thousand rubles.
Consume Housing
Ivanov =IF(OR(C3>0;D3>0); B3*0.1;””)
Petrov =IF(OR(C4>0;D4>0); B4*0.1;””)
Kuzmin =IF(OR(C5>0;D5>0); B5*0.1;””)
Sukhov =IF(OR(C6>0;D6>0); B6*0.1;””)
Nikolaev =IF(OR(C7>0;D7>0); B7*0.1;””)

Rice. 9.6. Logical OR function combined with IF function

The logical function in our example will look like

=IF (OR (C3>0; D3>0); B3*0.1; " ")

This logical function means the following: if, simultaneously or separately, the debt on a consumer loan and a housing loan is greater than zero, then it is necessary to withhold 10% of the accrued amount, otherwise it is necessary to display the gaps.

Let's write it in cell E3, and then copy it to cells E4:E7.

In columns C and D (Fig. 9.7) employees will be found who have debt for at least one type of loan, and in column E they will be deducted 10% of the amount accrued to them. One employee has no debt on the loan, then spaces will be displayed in column E opposite his last name.

Fig.9.7. Result of logical OR function
in combination with the IF function

NESTED LOGICAL IF FUNCTIONS

Recording format:

=IF(condition #1; expression B; IF(condition #2; expression C; IF (...)))

In principle, there can be any number of nested functions, but the total length of the line should not be too long, as this makes it difficult to read; In addition, you must ensure that the number of open parentheses is exactly equal to the number of closed parentheses.

Example. Find employees who simultaneously have debts on both types of loans, and withhold 20% of the amount accrued to them to repay the loans (Fig. 9.8). From other employees who have debt on any one type of loan, 10% of the amount accrued to them is withheld. For employees who do not have loan debt, enter “b/c” in the “Withheld” column.

In our example, the logical function will look like this:

=IF (AND (C3>0; D3 >0); B3*0.2; IF (AND (C3=0; D3=0); "b/k"; B3*0.1))

This logical function means the following: if at the same time the debt on a consumer loan and a loan for housing construction is greater than zero, then it is necessary to withhold 20% of the accrued amount, if both debts are simultaneously equal to zero, then it is necessary to withdraw “b/c”, otherwise it is necessary to withhold 10% of the accrued amount.

Let's write it in cell E3, and then copy it into cells E4:E7 (Fig. 9.8).

In columns C and D (Fig. 9.9) employees will be found who have debts on two types of loans. They will be charged 20% of the amounts accrued to them. Opposite the last name of an employee who has no loan debt, “b/c” will be displayed in column E. Finally, 10% of the amounts accrued to them will be withheld from other employees.

A IN WITH D E
Full name Accrued, thousand rubles. Loan debt Withheld, thousand rubles.
Consume Housing
Ivanov =IF(AND(C3>0;D3>0); B3*0.2; IF(AND(C3=0;D3=0); “b/c”); B3*0.1
Petrov =IF(AND(C4>0;D4>0); B4*0.2; IF(AND(C4=0;D4=0); “b/c”); B4*0.1
Kuzmin =IF(AND(C5>0;D5>0); B5*0.2; IF(AND(C5=0;D5=0); “b/c”); B5*0.1
Sukhov =IF(AND(C6>0;D6>0); B6*0.2; IF(AND(C6=0;D6=0); “b/c”); B6*0.1
Nikolaev =IF(AND(C7>0;D7>0); B7*0.2; IF(AND(C7=0;D7=0); “b/c”); B7*0.1

Fig.9.8. Nested logical IF function

Rice. 9.9. Result of executing a nested logical IF function

Logic function NOT converts an existing boolean value and evaluates to TRUE if the argument is FALSE, and vice versa.

Logic function IFERROR returns IF_ERROR if the expression is false. Otherwise, the function returns the expression itself.

A common Excel question is “How to write multiple conditions in one formula?” It is especially common to use two or more conditions when using the IF function. Making several conditions in the IF formula is quite simple, the main thing is to know the basic principles. We discuss them below.

In my opinion, it is instructive to consider an example of solving a system of conditions. Such tasks are often given in institutes, in Excel classes.

For example, there is this rather cluttered formula:

Let's look at an example of how to transfer it to Excel

It is clear that this formula will consist of at least 3 parts:

SIN(B1)^2 =COS(B1) =EXP(1/B1)

But how can we write several of these functions into one, also by condition? To understand this, let's take a closer look at the IF function.

Its composition is as follows:

IF(Condition;if condition = YES (TRUE);if condition = NO (FALSE))

Those. if we write down a simple formula, what do we end up with in cell B2?

Correct - 100 will be displayed. If A1 contains any other value other than 1, then B2 will display 0.

Let's return to our system of conditions. Now we need to understand how to write two conditions at once before the first semicolon. We have empty B1, which means = 0, and only if both conditions A1=1 and B1=0 (sign *) are met will the value of the formula be equal to 100.

Let's take a closer look at the * between brackets

The And operator * means that both conditions must be met simultaneously, A1=1 and B1=0.

If you put + (or) between the brackets, then one of the conditions will be sufficient. For example, only if A1=1, then 100 will be displayed.

We are ready to write the formula, we will do it in parts

Let's write down the first condition

IF((B1>-2)*(B1<9);SIN(B1)^2);

If the condition is met, then the first formula with sine is executed
If not, the second condition

IF((B1>-2)*(B1<9);SIN(B1)^2;IF((B1>=9)*(B1<=19);COS(B1)

In all other cases, the formula =EXP(1/B1) will be satisfied
The total is:

IF((B1>-2)*(B1<9);SIN(B1)^2;ЕСЛИ((B1>=9)*(B1<=19);COS(B1);EXP(1/B1)))

Writing several formulas in one

If there is text in cells B1, the formula will generate an error. That's why I often use the formula.

Let's imagine that our entire formula from the previous paragraph is one conditional argument A

Then =IFERROR(A;"")

Or for our example

IFERROR(IF((B1>-2)*(B1<9);SIN(B1)^2;ЕСЛИ((B1>=9)*(B1<=19);COS(B1);EXP(1/B1)));"")

The example can be downloaded

"fork".
Branching out is an algorithm in which one of several possible options for the computational process is selected. Each such path is called branch of the algorithm.

A sign of a branching algorithm is the presence of condition checking operations. The most common way to test a condition is to use the if statement.

if can be used in full or incomplete fork form.

In case of incomplete fork if Condition true, then BlockOperations1 executed if Condition false, then BlockOperations1 is not executed.

In case of a complete fork if Condition true, then true BlockOperations1 , otherwise executed BlockOperations2 .

BlockOperations may consist of one operation. In this case, the presence of curly braces demarcating the block is optional.

Example in C:

1
2
3
4
5
6
7
8
9
10
11
12
13
14


#include
int main()
{
int k; // declare an integer variable k
printf("k= " ); // display a message
scanf("%d" , &k); // enter variable k
if (k >= 5) // if k>5
printf("%d >= 5" , k); // print "VALUE >= 5"
else // otherwise
printf("%d< 5" , k); // print "VALUE< 5"
getchar(); getchar();
return 0;
}


Execution result

The if statement can be nested.

Example in C:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

#define _CRT_SECURE_NO_WARNINGS // to be able to use scanf
#include
#include
int main() (
int key;
system("chcp 1251" );
system("cls" ); // clear the console window
printf();
scanf("%d" , &key);
if (key == 1) // if key = 1
printf( "\nFirst item selected"); // display a message
else if (key == 2) // otherwise if key = 2
printf( "\nSecond item selected"); // display a message
else // otherwise
printf(); // display a message
getchar(); getchar();
return 0;
}

Execution result





When using a nested form of an if statement, the else option is associated with the last if statement. If you want to link an else option to a previous if statement, the inner conditional statement is enclosed in curly braces:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

#define _CRT_SECURE_NO_WARNINGS // to be able to use scanf
#include
#include // to use the system function
int main() (
int key; // declare the whole variable key
system("chcp 1251" ); // switch to Russian in the console
system("cls" ); // clear the console window
printf( "Enter item number, 1 or 2: ");
scanf("%d" , &key); // enter the value of the key variable
if (key != 1) ( // if key is not equal to 1
if (key == 2) // if key is 2
printf( "\nSecond item selected"); // message output
} // if key is neither 1 nor 2, then nothing is output
else // otherwise if key is 1
printf( "\nFirst item selected"); // message output
getchar(); getchar();
return 0;
}


Execution result





Ternary operations

Ternary conditional operator has 3 arguments and returns its second or third operand depending on the value of the Boolean expression given by the first operand. Syntax of ternary operator in C language

Condition? Expression1: Expression2;


If fulfilled Condition, then the ternary operation returns Expression1, otherwise - Expression2 .

Ternary operations, like conditional operations, can be nested. Parentheses are used to separate nested operations.

The above example using ternary operators can be represented as

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

#define _CRT_SECURE_NO_WARNINGS // to be able to use scanf
#include
#include // to use the system function
int main() (
int key; // declare the whole variable key
system("chcp 1251" ); // switch to Russian in the console
system("cls" ); // clear the console window
printf( "Enter item number, 1 or 2: ");
scanf("%d" , &key); // enter the value of the key variable
key == 1 ? printf( "\nFirst item selected") :
(key == 2 ? printf( "\nSecond item selected") :
printf( "\nThe first and second items are not selected"));
getchar(); getchar();
return 0;
}

Switch statement (multiple choice statement)

The if statement allows you to choose between only two options. In order to select one of several options, you must use a nested if statement. For the same purpose, you can use the switch branch operator.

General recording form

switch (IntegerExpression)
{
case Constant1: BlockOperations1;
break ;
case Constant2: BlockOperations2;
break ;
. . .
case Constant: BlockOperationsn;
break ;
default: DefaultOperationBlock;
break ;
}

The switch statement is executed as follows:

  • calculated IntegerExpression in parentheses of the switch statement;
  • the resulting value is compared with the labels ( Constants ) in case options, the comparison is performed until a label corresponding to the evaluated value of the integer expression is found;
  • running BlockOperations corresponding label case ;
  • if the corresponding label is not found, then DefaultOperationBlock , described in the default option.

The default alternative may not be present, in which case no action will be taken.
Option break; exits the switch statement and moves to the next statement. If the break option is absent, all statements will be executed, starting with the one marked with this label and ending with the statement in the default option.

Constants in case options must be of integer type (can be characters).

One of the most popular features in Excel applicationIF. It's logical comparison meaning and the result obtained. To put it simply, the function might sound like this:

IF the condition is true, then we do it, otherwise we do something else

Syntax This function is quite simple:

IF (logical_condition; value in case_TRUE; value in case_FALSE)

Let's take a closer look:

  • Logical_condition– the value that we will check
  • Value_in_case_TRUE– action when a requirement is fulfilled
  • Value in case_FALSE– action when the Logical_condition is not satisfied

How to use the function

Example No. 1

The screenshots below show the simplest use case. We first checking given condition A1>25. IF this is a requirement running, then output to cell “ more than 25", otherwise " less than or equal to 25».

Example No. 2

Now more difficult task. Below we will look at an example of recertification of enterprise employees. Initially the table looks like this:

Us necessary in column C, display the results of recertification, which can take a binary value: PASSED or FAILED. Our criteria will be as follows: who dialed more than 45 points, he is considered who passed exam, but everyone else doesn’t.

To complete a task necessary:


We use several conditions

If necessary, the function IF Can invest into each other. Thus, we will expand the solution options.

For example, let’s take the recertification of employees, which we discussed earlier. Let's change the result criteria and We'll give everyone a rating: Bad, Good and Excellent. Great we will put when the points will exceed 60. Evaluation You can get it well by typing from 45 to 60 points. Well, in other cases we set Badly.


As can be seen from the example, instead of the second and third values ​​of the function, you can substitute a condition. In this way we add the required number of attachments. However worth noting that after adding 3-5 attachments it will become almost impossible to work with the formula, because it will be very bulky.

Other uses of the function

Finding the sum of columns or cells

For example, there is a need to sum every second cell of a column. In this case, using the operator will help SUMIF. It will allow you to work only with those columns that meet our requirements. We will consider the case when it is necessary to sum elements in odd rows.

To solve the problem, we need insert additional column and number the rows 1 and 0. It is this data that we will use in our formula. The example shows what formula we used.

Syntax: SUMIF(cell_range; used_condition; [sum_range])

  • Range– required argument. Here you set a range that is evaluated for compliance with the condition.
  • Condition_used– here we indicate which cells need to be summed.
  • Sum_range– indicate which range to use for summation.

Number of repetitions of elements on a sheet

In this case, we can count how many times a given element appears on the sheet. To do this we use the function COUNTIF. It counts the number of cells that match with a given value.

In this example, we count how many clients are in each city. In the formula, we specify the range first, and the values ​​to be searched for second.

We use COUNTIF and SUMIF when calculating data

In the example we will try to determine average income from clients in each city. To do this, we divide the total income of the city by the number of clients.

Finding multiple occurrences of an element in a list

If we have a constantly updated list of data, in which, as it grows, duplicates, then finding entries in this list may be difficult. The easiest way to solve this problem is to use the function VLOOKUP And COUNTIF.

For starters, let's add additional column to add serial number occurrences of the client's name. As a result, the first mention of the element will produce Name1, the next Name2, etc.

We use search by client Christina Aguilera. Using the VLOOKUP formula ("Christina Aguilera3", search_range, 2, FALSE), we will get the third number of this client. In the formula, we set the last value to FALSE, since the list is not sorted and we need an exact match of the elements.

How to reduce the number of investments IF

Versions up to and including EXCEL 2003 supported up to 7 levels nesting IF. Starting with Excel 2007, this is a limitation removed. But it is worth noting that few people go below 3-4 levels of nesting.

To reduce the use of IF nestings, you can use the function CHOICE. It works with values ​​or actions from a given list by index number.

Syntax: SELECT (index_number; index_value1; index_value2; [index_value3];…)

For example, the function CHOICE (1; "Third"; "Second"; "First"), will return us the word " Third"if we add it to a cell.

It is worth noting that there are some restrictions. In particular, the index can be only numbers.


Close