You are on page 1of 26

Computer II

Revision
• Formatting of cell:

o Format>>cells

 Number: the format that will be entered into


the cell

For example: if we want to enter $1,000

Format>>cells>>currency

 Alignment: the position of the text

• Text alignment: how the text is aligned.

• Orientation: how the cell will be


oriented in the cell Example:

If we want to change
the orientation we will
drag the text arrow
according to the
orientation we want
Result:

• Text Control:

o Wrap text: if we have two words in


the same cell beside each other and
we want to put each word on a
separate line.

Example:
Result:

o Shrink to fit: shrinks the text inside


the cell in order to be able to fit
into the cell

o Merge cells: opens the cells to be


one cell.

 Font: this tab is responsible to change the


font style, color, etc.

 Border: this tab is responsible to insert


borders on cells.

 Patterns: this tab is responsible for shading


of cells. (fill color of cells)

o Format>>Rows

 Height: to adjust the height (in points) of a


certain row

 Autofit: allows the text to fit in one row.

For example: if we have a sentence that


doesn’t fit in one cell by applying autofit, it
will fit into this cell.

o Format>>Column
 Width: to adjust the width (in points) of a
certain column

 Autofit: allows the text to fit in one column

• Sorting:

o Data>>Sort

 Before you select sort, you have to first


select you range that you want to sort

Example:

Then you will select Data>>sort, this box will


appear:
You will select in the sort by part how do you
want to sort, by number, or by text, or
whatever the data that is present in you
range. Then you will specify how do you
want to sort it, either in ascending order
(from small to big), or in descending order
(from big to small). Then press OK, your data
will then be sorted.

Result:

• Simple Formulas:

o Add, subtract, multiply, divide


In order to perform any of the above operations
using excel you will have to put their signs as
follows: +, -, *, /

o N.B. Priorities goes to brackets, then to division,


multiplication, addition, subtraction.

Ex:

2+3*8=26; here 3*8 was performed first then


2+3 because multiplication has a higher priority
then addition.

(2+3)*8=40; brackets were done first because


brackets has a higher priority then multiplication.

Example:

If we want to add (or perform any of the above


operations) the following using excel:

(1) 2+3

(2) A1+B2+C3

 Answer (2+3): first of all we have to put the


equal sign before we write anything, then we
will write the numbers we want to calculate,
and then we press enter.
After we press
enter:

 Answer (A1+B2+C3): if we have the


following excel sheet and we want to add the
content that is in cells A1, B2, and B3, all we
have to do is select the cell that we will write
the formula in, we will add these three
numbers by clicking on each cell, we will
click on A1, then type +, then click on B2,
Example: then type +, then
Howclick on C3, and then
to do it:
enter.

Result:

• Relative Reference:

o When you copy a formula from one cell to


another Excel will automatically paste adjusted
references in the destination cells relative to the
position of the formula.
o If you drag the Autofill Handle down or copy the
formula down, the range reference B2:B4 for
example is changed to B3:B5, where the row
numbers are changed but column letter remain.

o Example: if we have the following data, we have


the salary and the bonus and we want to
calculate the total salary which is the salary +
bonus. We will write the addition equation in the
first cell of total salary column which is C2, as
shown:

After we press enter and we get the result for


the first set of numbers (A2+B2), we will stop
with the cursor of the mouse at the corner of
the cell until a small black cross appears, we will
then drag until we reach the last set of number,
and at the end we will find that the total salary
has been automatically calculated without
writing the equation all over again.
And that is how excel has adjusted the
references according to the destination.

• Absolute Reference:

o We use absolute reference if we don’t want excel


to adjust references when we copy a formula to a
different cell.

o Example: if we have a formula, =B2*B7, and we


copy the formula to another cell, Excel will adjust
both references. If we copy down one cell,
=B2*B7, is changed to =B3*B8. If we don’t want
B7 to change to B8 we must make B7 absolute
reference by placing a dollar sign ($) before the
parts of the reference to be $B$7.

This can be done by putting the cursor in the


formula bar before B7 for example and press the
button F4.

• Simple Formula:

o In order to write any formula we have to write


the “=” sign before we write anything.

o The following table illustrates our functions:


Function Name Description Result
Sum() adds values or =SUM(1,4,7)
ranges of cells within Result: 12
the parenthesis

Count() Counts the number of =COUNT(1,4,B3,20)


cells that contains Result: 4
number from the
arguments

CountA() Counts the number of =COUNTA(1,4,B3,20)


cells that are not Result: 4
empty from the
arguments. Also
counts the cells that
have text in them.

CountBlank() Counts empty cells in =COUNTBLANK(A3:A5


a specified range of )
cells Result: 1

Countif() Counts the number of


cells within a range
that meet a single
criterion that specify.

Max() find the largest =MAX(20,25,15)


number from the Result: 25
arguments

Min() Find the smallest =MAX(20,25,15)


number from the Result: 15
arguments

Average() Find the average for =AVERAGE(20,25,15)


the arguments Result: 20

Mode() Returns the most =MODE(1,4,4,4,5)


frequent numbers in Result: 4
an array or a range of
data.

Median() Returns the median =MEDIAN(1,2,3,4,5,6)


of the given Result: 3
numbers. The median
is the number in the
middle of a set of
numbers

Stdev() Returns the standard =stdev(20,30,40,50)


deviation of a set of Result: 12.90994449
numbers

Example: Solve the following questions:

(1) Calculate the total for Salary column

(2) How many employees are there

(3) How many employees do not have an ID

(4) How many employees live in Alex, and how


many in cairo

(5) How many students take a salary 1,000, and


how many takes 2,000

(6) Find the maximum salary

(7) Find the minimum salary

(8) Find the average of the salary column


(9) Find the mode and median of salary column

(10) Find the standard deviation of the salary


column.

Solution: Answers to the previous questions:

(1) =SUM(D2:D6); 7000

(2) =CountA(A2:A6); 5
(3) =Countblank(B2:B6); 2

(4) =countif(C2:C6,”Alex”); 3. (same thing to be done


with cairo)
(5) =countif(D2:D6,”1000”); 3 (same thing to be
done with 2,000)
(6) =max(D2:D6); 2,000
(7) =min(D2:D6); 1,000

(8) =average(D2:D6); 1,400


(9) =mode(D2;D6); 1000
=median(D2:D6); 1000

(10) =stdev(D2:D6); 547.7225575


• Functions:

Function name Equivalent in Excel


Ln Ln
Log Log
Factorial or ! fact
Square root or sqrt
Exponential or e(x) Exp(x)
Power (x)^2
Example: (x)2 “^” is written by pressing
shift+6
• Examples: given then value of x calculate the
following functions:

(1) f(x)1 = log(x) + ln(x) +

(2) f(x)2 = (x)2 + e(x) + (x-1)!

(3) F(x)3 =

• Solutions: (how to write them using excel)

N.B. you don’t have to write each function for each


number every time, you will only write it in the first
cell, and then drag it to the rest of the cells using fill
handle.

(1) f(x)1: =log(A23) + ln(A23) + sqrt(A23^2 +


fact(A23+1) + exp(A23))

answer: 33526120087
(2) f(x)2: =A23^2 + exp(A23) + fact(A23-1)

(3) f(x)3: =sqrt(fact(A23+1) + log(A23))


• if statements:

o The if statement returns a value if a certain


condition is TRUE, and another value if the same
condition is FALSE.

For example, if we have a condition that states if


a number is more than 10, then we write over 10,
and if it is not, then we write less than 10.

o The syntax of the if statement is as follows:

=if(logical_test, value if true, value if false)

So if we want to write the above example in the if


statement, first we have to check which is our
logical test, which is our value if it is true, and
which is our value if it is false. When we write our
if statement, we will write our logical test, then a
, (comma), after the first comma excel will
understand that we are writing our value if true,
then we write the second ,(comma), excel will
also understand that after the second comma we
are writing our value if false.

In the above example our logical test is if a


number is more than 10, our value if true is that
Value if true
we will write
Logical test more than 10, and if it is Value
false if false
we
will write less than 10.

Answer: =if(I2>10,”more than 10”,”less than


10”)

o Solve the following using if statements:

(1) X=50

If X<=100, return within budget, otherwise


return over budget.

(2) X=50

If X = 100, return X*50, otherwise return X +


50

 Solutions:

(1) =if(I4<=100,”within budget”, ”over


budget”)

Answer: within budget


(2) =if(I4=100,I4*50,I4+50

Answer: 100

o Nested If: nested if means more than one


statement in one if statement.

o Example: in a university we want to find the


grade from the total of the student, we have a
range of totals each with a different grade.

The university system states that:

<=90 then you have a grade A

<=80 then you have a grade B

<=70 then you have a grade C

<=60 then you have a grade D

>60 then you have a grade F


In order to solve this problem using if statements
we will need more than one if statement, and we
will write them all in one if statement.

So this is how the if statement will look like:


(each if statement will be highlighted in red)
Value if true Value if false will contain the
next if
Logical_test

=if (cell number>=90, “A”, if ( cell number>=80,


“B”, if ( cell number>=70, “C”, if ( cell
1st if number>=60, “D”, if ( cell number<60, “F”)))))

• Matrices:

We have three functions needed to work with


matrices, multiplication of 2 matrices, the inverse if a
matrix, and the determinant of a matrix.

Functions:

(1) Multiplication: =mmult

(2) Inverse: =minverse

(3) Determinant: =mdeterm

Example:
Matrix Y
Matrix X

1 2 3
4 5 6
7 8 9

10 11 12
13 14 15
16 17 18

• To multiply these 2 matrices:

X*Y=

First you will have to highlight the range that you will
put your answer in

Then you will write =mmult(highlight matrix X,


highlight matrix Y), then press Ctrl+Shift+Enter.

• To find the inverse of a matrix:

X-1=

First you will highlight the range you will put the
answer in as shown above, then you will write
=minverse(highlight matrix X), then press
Ctrl+Shift+Enter

• To find the determinant of a matrix

Select one cell only, then write =mdeterm(highlight


matrix X), then press enter.
• Charts:

To insert a chart, you will select the columns needed,


then you will press insert>>chart, and then select the
shape of the chart given.

You might also like