G2A

Tabužky



Kontakt: palkovaj@yahoo.com
Dátum poslednej aktualizácie ... 27.januára 2008

Valid HTML 4.0!

Decision making - IF clause:

Sometimes we need to create a table based on some decision - for example some tables sort people into groups according to their gender or age, some tables allocate students grades according to their performance on the test... 

Table calculators offer us logical functions to sort information according to a condition statement. The program then looks at the condition and performs one action if the statement is true and another if it is false. The structure of the logical condition in MS Excel is:

IF(condition;true;false) 

where instead of condition you write your logical statement using the signs of comparison (=, <, >, <=, >=); instead of true you write what should be written in the cell when the statement is true and instead of false you write what happens otherwise.

The function in Slovak MS Excel is: AK(podmienka;áno;nie)
The function in Czech MS Excel is: KDYŽ(podmínka;ano;ne)

Nesting of IF clauses:

The functions can be also nested (written one into another). This happens when we have more conditions and wanted results: if condition is true, write answer, else if another condition is true, write a different answer, else... In MS Excel this function would look like: 

IF(condition;true;IF(condition;true;IF(condition;true;false)))

Of course you may put the condition statement also into the true section, that depends on the problem you are solving.

Logical function AND:

Another logical function that you may use in your decision making calculations is function AND. This function takes two or more conditions and only if all of the conditions are true then the whole function is true. For example if a person is above 10 years old, AND also below 18 years old, he or she is a teenager. The syntax of this function is like:

AND(condition1 ; condition2 ; ...here you may put any number of conditions...) or, in Czech or Slovak MS Excel use "A" instead of "AND" To use this function inside an IF statement, write it in place of condition:

IF(AND(A1>10;A1<18);"teenager";"not a teenager")



1. Follow the image below to complete the exercise. Create a table where

  1. you devide people in the table into two groups "Girls" and "Boys" according to their gender
  2. you divide them into groups "Child" (younger than 10), "Teenager" (between 10 and 18) or "Adult" (18 and above) according their age
      exercise

2. Create a table acording to the example and complete it calculating

  1. percentage each student got for their test
  2. grade that each student got for the test - based on the table of percentages and grades
      exercise

3. Copy the above table below and create a calculation that decides, who belongs to which age cathegory - use AND function. The ranges are:

  • child: below or equal 10
  • teenage: above 10, below 18
  • adult: above or equal 18, below 65
  • old: above 65
      exercise