Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

LOGICAL FUNCTIONS

EXCEL

ISCTE Business School - ICT for Management

Professor Abílio Oliveira

Beatriz Pereira Nº87539


Inês Martins Nº87270
Miguel Coelho Nº87399
Tomás Liladar Nº88264
Introduction
Logical functions enable you to perform a big variety of actions and solve many Excel
problems. They are used in order to perform difficult calculations, simplify them, and
analyse their logical values.
The logical functions we chose to elaborate on are: TRUE() , FALSE() , IF() , AND() , OR() , NOT().
Being logical functions, all of them are related and the functions’ conditions return
logical values TRUE or FALSE, except the IF() function.

We will start by presenting each function and then, through examples and exercises, we will
demonstrate how to use them in practical terms.
This work is complemented by a video, in which the Logical Functions are demonstrated in Excel and
explained in the context of an exercise.
Logical functions

IF Function
The IF() function verifies whether a condition is reached, and returns one value if
TRUE and another value if FALSE. With this function, we can choose what we want it
to return. Its condition is:

=IF(logical test; value if true; value if false)

Argument name
● logical_test: The condition you want to test.
● value_if_true: The value that you want returned if the result of logical_test is TRUE.
● value_if_false: The value that you want returned if the result of logical_test is
FALSE.

Example:
The function gives a comparison between the
ages of Joshua and his friends. Since Elisabeth
(B3) is 17 (C3) and Joshua (B2) is 18 (C2), the
will return “older”.

=IF(C2>=C3;"older";"younger")

On the other hand, we can see that Mark is 19 (C4), so the function will return “younger”.

=IF(C2>=C4;"older";"younger")

True and False Functions


Presented with a logical condition, the functions TRUE() and FALSE() return TRUE or
FALSE, respectively, depending on the logical value.
These functions are different from all the others, because we don’t have to write them
in order to use them. Their conditions are simply:
=TRUE()
=FALSE()

These conditions have no arguments.


Example:
If the value in cell A3 is 0.20 (cell B2), then Excel will return
“TRUE”.

=A3=B2

However, in the cell A4, the square root of 7 is not the same as in B2, so the Excel will return
“FALSE”.

=A4=B2
And / Or Functions
The AND() function returns TRUE if all conditions are true and returns FALSE if at
least one of the conditions is false. Its condition is:
=AND(logical 1; logical 2;...)The AND function syntax has the following arguments:
● Logical 1: The first condition that you want to test that can evaluate to either TRUE or
FALSE.
● Logical 2: Additional conditions that you want to test that can evaluate to either TRUE or
FALSE, up to a maximum of 255 conditions.

Example:

When the student grade (B3 to B5) is higher than the average grade (E1) and the minimum grade
(E2), Excel will return “TRUE”. Otherwise (as
in B8 and B9), the function will return “FALSE”
because at least one of the conditions fail.

B8 -> =AND(B3>E2,B3>E1)
B9 ->=AND(B4>E2,B4>E1)
B10->=AND(B5>E2,B5>E1)

The OR() function returns TRUE if any of the


conditions are true and returns FALSE if
every conditions are false. Its condition is:

=OR(logical 1; logical 2;...)

The OR function sintax has the following arguments:

● Logical 1: The first condition that you want to test that can evaluate to either TRUE or
FALSE.

● Logical 2: Additional conditions that you want to test that can evaluate to either TRUE or
FALSE, up to a maximum of 255 conditions.

One common use for the OR and the AND function is to expand the usefulness of other functions that
perform logical tests. For example, the IF function performs a logical test and then returns one value if
the test evaluates to TRUE and another value if the test evaluates to FALSE. By using the OR
function as the logical_test argument of the IF
function, you can test many different conditions
instead of just one.

Example:
When the student grade (B3 to B5) is higher than
the average grade (E1) or the minimum grade
(E2), Excel will return “TRUE”. Notice that to
return “TRUE” you only need to satisfy one of the
conditions, as you can see in Grace´s example
(B9)
B8 -> =OR(B3>E2,B3>E1)
B9 ->=OR(B4>E2,B4>E1)
B10->=OR(B5>E2,B5>E1)

Not Function

Not is a function which allows us to get a result which will be the reverse of its argument. Therefore, if
the argument is TRUE, the function will return FALSE and vice-versa.

=NOT(logical)

The NOT function syntax has the following arguments:

● Logical: A value or expression that can be evaluated to TRUE or FALSE.

If logical is FALSE, NOT returns TRUE; if logical is TRUE, NOT returns FALSE.

One common use for the NOT function is to expand the usefulness of other functions that perform
logical tests. For example, the IF function performs a logical test and then returns one value if the test
evaluates to TRUE and another value if the test evaluates to FALSE. By using the NOT function as
the logical_test argument of the IF function, you can test many different conditions instead of just one.

Example:

Josh wants to buy a new cell phone,


but he does not want to buy a Wiko
cell phone. When he went to the
store, he found the 5 brands presented above. To find out the cell phones he is interested to buy we
use:

=NOT(B3=H$2)
Note: it's necessary to repeat the process for the cells C4 to C7.

Solved Example
John and Kara want to buy a video game for their birthday. In the store there are several options.
They will choose the game based on their preferences and conditions. John prefers a
Action/Adventure game in PS3, but his father Abílio said he can’t spend more than 50 bitcoins. Kara
wants a Strategy or a Sports game for any platform (except Wii), but she can't spend more than 25
bitcoins. Consider the following table that refers to the genre, price and type of platform of each game.
1. Verify if the games are in concordance with John’s favourite genre (use the G column).
=D4=G$3

2. What about John’s platform? (use the I column)


=C4=I$3

3. Taking into account John’s budget and the factors confirmed in the previous question, which
are the games that he can buy? (Use “--” to fill the false argument)
=IF(AND(E4<=50;G4=TRUE;I4=TRUE);"Can buy"; "--") or
=IF(AND(E4<=50;G4=“Action/Adventure”;I4=”PS3”);"Can buy"; "--")

4. Now, confirm if all the games are compatible with Kara’s preferences. (use the K column)
=OR(D4=K$3;D4=L$3)

5. Find out if all the games are available to Kara’s possible platforms. (use the M column)
=NOT(C4="Wii")

6. Which are the games that Kara can buy, after all, according to her preferences and budget?
=IF(AND(E4<=25;K4=TRUE;M4=TRUE);"Can buy"; "--")

Unsolved Exercise
Abilio’s company is searching for a candidate that suits certain criterias for an adjutancy. In the
following table, there are some candidates and the company’s perfect candidate is presented.
Observe and, according to the questions you have below, obtain the results on the following table
(Note: take into account the row 8 in the table above):

1. Verify if the candidates meet the educational requirements asked by the company. (use the
column B)
2. a) First of all, discover which one of the candidates have experience abroad and suit the
educational requirements? (use the column C)
b) Now, conclude which of them do not meet this 2 criterias (use the column D)
3. Suppose that to be hired, the candidate needs to meet:
● Educational requirement
● Years of experience
● Experience abroad OR language spoken criterias
What are the candidates that can be recruited? In the cell E2 to E7 - in the results table -,
when using the formula, use Recruited if they meet the criteria, Not Recruited if they do not.
4. Taking into account all the criterias (row 8 in the first table),how can we discover if there were
any candidates hired by Abilio´s company? (Use column F in the results table to put the
formula)
5. Which formula can the company use to allow 3 candidates of this list to be hired?
a. =IF(B2=B$8;”Hired”;”Not hired”)
b. =IF(AND(C2=C$8;AND(E2>=25;E2<=40));”Hired”;”Not hired”)
c. =IF(OR(F2=F$8;D2=D$8);”Hired”;”Not hired”)
d. =IF(AND(C2=C$8;OR(D2=D$8;F2=F$8));"Hired";"Not hired")

Conclusion
After evaluating these functions: IF(), TRUE(), FALSE(), OR(), AND() and NOT(), we
concluded that every single one of them has its own purpose and also that they can all be combined
with each other in order to achieve more complex and relevant results. We can use these functions to
obtain results relative to comparisons of many situations that can occur in life. More than that, we use
them when we want to state a condition to apply to certain informations, which will give us a result.
Therefore, these conditions, which appear to be really simple on the first hand, are actually
much more than that and can be extremely important to help up us solving problems which we
wouldn’t be able to otherwise.

You might also like