AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Contents · Computing

Text and logical functions

Lessons 9–10 · 2 lessons · N. I. Taylaqov (general editor), A. B. Akhmedov, M. D. Pardayeva, A. A. Abdug‘aniyev, U. M. Mirsanov. Informatics and Information Technologies, Grade 10, 1st edition. “Extremum-Press”, Tashkent, 2017
10

Logical functions

Textbook: pp. 26–28
GoalPerforms condition-based calculations with IF, AND and OR and writes nested IF.
New words
IF: gives one value if the condition is true and another if it is false · IF funksiyasiAND: true only when all its conditions are true · AND funksiyasiOR: true when at least one condition is true · OR funksiyasinested IF: an IF placed in the true or false part of another IF · ichma-ich IF
Explanation

Some calculations depend on a condition: if the condition is met one result should appear, otherwise another. For this IF(condition, value_if_true, value_if_false) is used. A condition is written with comparison signs: =, <>, <, >, <=, >=. To combine several conditions, AND(c1, c2, …) gives TRUE when all are true, OR(c1, c2, …) gives TRUE when at least one is true, and NOT(c) reverses a condition. With more than two outcomes another IF is written inside the IF: the conditions are checked starting from the strictest. In newer Excel the IFS function shortens such a chain, but nested IF works in every version. Text results are written in quotation marks.

SignMeaning
=equal
<>not equal
<less
>greater
<=less or equal
>=greater or equal
💡 Where will I use this?
In real life

A school sports club has a rule: a pupil who attends at least eight sessions gets a badge, otherwise the list says “keep going”. The table checks the rule for each row by itself, so the teacher does not have to read hundreds of rows.

Who uses it

Programmers, game designers and school office staff check “if ... then ..., otherwise ...” rules automatically.

Try it today

Write one rule of your own, such as “if it rains, take an umbrella, otherwise a cap”, and test it against two different kinds of weather.

Worked examples
StartB2B2 ≥ 90yesno5B2 ≥ 75yesno4B2 ≥ 60yesno32End
A grading scale: =IF(B2>=90,5,IF(B2>=75,4,IF(B2>=60,3,2))). If B2 = 82, the first condition is false, the second (82 ≥ 75) is true, so the result is 4. B2 = 90 gives 5 and B2 = 59 gives 2.
=IF(AND(B2>=60,C2>=60),"qabul","rad") and =IF(OR(B2>=60,C2>=60),"qabul","rad")
B2C2ANDOR
7258radqabul
Two exams: =IF(AND(B2>=60,C2>=60),"qabul","rad"). If B2 = 72 and C2 = 58, the second condition is false, AND is false and the result is “rad”. With OR, =IF(OR(B2>=60,C2>=60),"qabul","rad") gives “qabul”.
Class activity

“Line up by condition”: students stand up if they meet the condition on a card (for example, “taller than 165 AND the name starts with A”); the class sees the difference between AND and OR in action.

Practice
1
What does =IF(AND(7>3,2>4),"A","B") give?
2
In the grading scale above, what is the result for B2 = 82?
3
A seller gets a 7% bonus if sales are at least 5 000 000 so‘m, otherwise 3%. What is the bonus on sales of 8 000 000 so‘m?
4
Why are the conditions in a nested IF written starting from the strictest?
Story of the Week · The Khwarizmi WayTeachers’ Day: the “free card” messageClose the week: all of this week’s subjects in one storyRead →