Download as pdf or txt
Download as pdf or txt
You are on page 1of 68

Chapter 4

MS Excel (Spreadsheets)
Spreadsheets
 A spreadsheet is consisted of rows and columns.
 It is used for mathematical calculations and plotting figures.
 In a spreadsheet, columns are lettered e.g. A, B …etc. and rows are numbered
 Cells get
their names
from column
and row
ID’s.

H3
E5

Selecting cells
 To select an individual cell, just click on it.
 To select a range of neighboring cells, click on a cell and while holding mouse
button drag the cursor.
 To select cells separately or apart from each other, press and hold Ctrl and
using mouse select the desired cells.
Changing the fill colour and font colour
cells and wrapping text

Font colour
Fill colour

To wrap a text
Workbook and sheets
 Each individual Excel file is called a workbook.
 A workbook contains a number of sheets.

Click on to add
another sheet
Sheets In Microsoft 2010
Inserting/edition data
 To insert data (text, dates or numbers) just click in a cell and start typing.
 To edit a cell, double click the cell and then you can edit it.
 If you want to apply some format (size, color, font etc.) click that cell once then do
the changes.

Selecting Rows and columns


 To select a row/column, place the cursor on the row/column ID
 When the cursor changes its shape to a black arrow click once.
 To select rows/columns apart from each other press and hold Ctrl

Sorting data
 Sorting means arranging data on a basis e.g. alphabetically, from greatest to smallest
or vice versa…etc.
 If you have a list of names inserted randomly you can arrange it alphabetically.
 If you have a list of numbers you can arrange them to start from the largest number
to the smallest and vice versa.
Sorting alphabetically/numerically
 Select the list of numbers/names, in “Home “ tab go to
Editing group, Sort & Filter

Sorts from smallest to


largest/ from A to Z

Sorts from largest to


smallest/ from Z to A
Copying/Moving
 To copy/move data, just select the cells to be copied/moved and press
Ctrl+ C/ Ctrl+x ( or right click, select copy/cut)
 In a new place, press Ctrl+V (or right click, select paste)
 To copy/move data between different sheets follow the same procedure

The autofill tool


 The autofill tool or handle repeats a formula, text, increments to other
cells.
 To inset months, you don’t need to type all the names.
 Type in “January” then use the autofill tool and all the months will be
inserted.
Using autofill tool
 Type a number such as “5” in a cell
 place the cursor on the handle, when the cursor changes
its shape to + then press and hold the mouse button and
drag it down and release it somewhere

Click here to open


the menu

If you select this option


then the numbers will
increase in each step by 1.
Autofill alternative
 You can use autofill not using autofill handle.
 Type in a number like “1”
 It is possible to command Excel to insert numbers
starting from 1 to for example 30 with increment of 1 or
any number.
 To do that in Home tab go to Editing group, Fill, series

Increment
Deleting cell contents
 To delete cell content, select cells then go to Editing
group, clear, clear content, or press delete in keyboard.
Alignment
 Horizontaly: Select the cell range to
be aligned from home tab and
Alignment group, select an alignment

 Verticaly: Select the cell range to


be aligned from home tab and
Alignment group, select an alignment
Inserting rows/columns
 To insert a row or column, go to Cell group in Home tab.
 Click on insert then insert sheet rows/columns
 Or select a row/column then right click and insert.
 By default, columns are inserted to the left and rows to
the above.
Deleting rows/columns
 In Home tab go to Cell group, Delete , Delete sheet
rows/columns.
 Or select a row/column then right click and delete
Modifying column width and row height
 It is possible to change width of column and height of
rows.
 To do that, in Cell group, go to format
AutoFit column width/Row height
 Sometimes it is easier to fit cells to content automatically
rather than changing dimensions manually.

 To automatically fit a column/row width/height to its


content, select that column/row, go to Cell group, Format,
AutoFit column width or AutoFit row height
Inserting/Deleting worksheets
 Additional worksheets can be inserted:
• Select the worksheet that you want to insert one to the right of it.
• Click on the button of sheet inserting located on sheet bar.

 To delete a sheet just right click on it and choose “Delete”.

Copying/Moving/Renaming worksheets
 To move a worksheet just click on it and hold the left button then drag it to a
desired place.
 To copy a worksheet do same as moving plus holding Ctrl key on keyboard.
 To rename a worksheet, double click on it and then you can rename it. Or right
click on the sheet and choose rename.
Copying/Moving/Renaming worksheets

 Or right click on the desired sheet and chose move or


copy then choose the place you want to move the sheet
to it and if you want to copy it tick Create a copy
Freezing and hiding rows/columns
 Freeze rows or columns:
 To freeze the first column: View>freeze panes> freeze first
column
 To freeze rows/columns: select the cell below the rows and to
the right of the columns you want to be visible when scrolling: from
view group>freeze panes>freeze panes.
 Unfreeze rows or columns:
 On the view tab>freeze panes>unfreeze panes.To unfreeze a row/
column, fisrt select it then from view group choose freeze and
choose unfreeze pane.
 Hiding and unhiding rows or columns:
 To hide a row/column: select a column/or rows then right click >
hide.
 To unhide a row/column: select a two adjacent columns/rows to
that column from right and left of the column/rows then right click
and> unhide
Exercise

7 Freeze column H

8 Hide column D
Formula and Functions
Arithmetic formulas
Mathematical functions and operations
 Power: use sign (^) e.g. =5^2
 Square root : (sqrt) e.g. =sqrt(2)
 Pi : =pi()
 Angles: Excel uses radian angles
 Use function Radians to change degree to radian and then
you can use trigonometric functions. E.g. =radians(30)
 Sin: e.g. =Sin(3)
 Cos: =Cos(3)
 Tan: =tan(3)
 N o t e 3 i s i n ra d i a n
Mathematical functions and operations
 Or go to Formulas> Math & Trig > then choose the
function you want
Exercise
 For x=1 to 5 calculate the following formula:
(𝑥 + 1)2 sin⁡(𝑥)
1
(3𝑥 + 𝑥2 − 2) 3
Border Effects
 To format cells with borders
and lines, do the following:
 • Select the cell or cell range
to be formatted.
 • From the Home tab and Font group,
select the Border arrow.
 • Select a border from the menu
or select More Borders at the bottom
of the menu. The Format Cells window
opens with the Borders tab selected.
Merging Cells

 To merge cells, do the following:


 • Select the cell range to be merged.
 • From the Home tab and Alignment group, select the
Merge & Center.
 • Choose a merge option from the menu
 To Unmerge cells do the same steps.
Functions

• To insert any formula, first type in “=“ then you can


write a formula or using a certain function
Sum
 This function is used to adding up numbers
 Click in a cell and type in “=“
 Now a formula or a function can be inserted
 Type in “sum”, from menu double click on it or press tab
key
 You can select the range that you wan to sum up or type
in the range e.g. A2:B6
 Close the parenthesis and
press enter
Information
on function

 Or goto formulas>Autosum>sum
Average
 The function calculates average of a range of numbers
 Click in a cell and type in “=“
 Type in “average”
 Double click on it in menu or press tab key or continue
writing “(“
 Specify range
 Close the parenthesis and
press enter
Min
 This function finds the minimum value out of a set of
numbers.
 Click in a cell and type in “=“
 Type in “Min”
 Double click on it in menu or press tab key or continue
writing “(“
 Specify range
 Close the parenthesis and
press enter
Maximum
 This function finds the maximum value out of a set of
numbers.
 Click in a cell and type in “=“
 Type in “Max”
 Double click on it in menu or press tab key or continue
writing “(“
 Specify range
 Close the parenthesis and
press enter
Count
 It calculates the number of cells filled with numbers in a
range.
 Click in a cell and type in “=“
 Type in “Count”
 Double click on it in menu or press tab key or continue
writing “(“
 Specify range
 Close the parenthesis and
press enter
Count A
 It counts the number of cells that contain numbers or
text in a range of cells.
 Click in a cell and type in “=“
 Type in “Count A”
 Double click on it in menu or press tab key or continue
writing “(“
 Specify range
 Close the parenthesis and
press enter
Round
 To round numbers to a specific digit after decimal
 Click in a cell and type in “=“
 Type in “Round”
 Double click on it in menu or press tab key or continue
writing “(“
 Specify range, specify number of digits after decimal
 Close the parenthesis, press and hold Ctrl then press
enter
Common errors
Common errors

Accidently column B got


deleted
Cell referencing
 In a formula such as A1+B1, cell referencing is relative.
 When autofill is used this formula is copied but the cell
references will change relatively e.g. A2+B2, A3+B3 etc.

 There are times that a absolute (constant) cell reference


is required e.g. multiplying a column by a constant

 To make a constant cell reference use $ : $A$1, $B$15


A1+$B$1
 A shortcut for absolute reference is F4 button on
keyboard.
IF statement
 This is a logical function. It is consisted of three parts:
1. A condition e.g. <=>
2. What to do if the condition is true.
3. What to do if the condition is false.
Or goto Formulas>Logical>IF>then fill it as below:
Using IF to return numerical values
 In a cell type “ =if( “
 Write a condition and type comma (,) .
 Type what to do if the condition is met and press comma
 Type what to do if the condition is not met and close the parenthesis.
Example: use if statement to solve the following: Write down the
statement here(first
𝑦 = 𝑥 + 1⁡ → ⁡⁡⁡⁡ (𝑥 < 4) value of y) then use
 autofill to find other
𝑦 = 𝑥 ⁡⁡⁡⁡⁡⁡⁡ → ⁡⁡⁡⁡⁡⁡⁡⁡⁡⁡⁡⁡⁡ (𝑥 ≥ 4) values.

X Y

2 3
Using If to return text values
 To return text values, use quotation marks (“):
 Type in “=if(“
 Type in a condition
 Type the text values for true or false arguments in quotation marks
 Example: Write down the
⁡⁡⁡⁡ 4 < 𝑥 < 4 → 𝑦 = 𝑁𝑜𝑡⁡𝑔𝑜𝑜𝑑 statement here(first
 value of y) then use
𝑥 = 4 → ⁡⁡⁡⁡⁡𝑦 = 𝐺𝑜𝑜𝑑⁡⁡⁡⁡⁡⁡⁡⁡⁡ autofill to find other
values of y.

=4,”Good”,”Not good”) Using


autofill
y will
X
automatic
ally give
2 Not Good you this
answer
Nested IF
 It is possible to use more than one IF statement at once.
 =If(condition , ” True argument” if(condition, “True argument”))
Example: Use if statement to comment on the below data in A column as follow:
 Mark>=80 Grade= Verygood
Write down the statement
 Mark>=70 Grade= Good
here(first value of Grade)
 Mark>=50 Grade= Pass then use autofill to find
 Mark<50 Grade= Fail other grades.

 Always start from conditions of highest values if you use greater than (>) sign.
While for < (less than) sign start from smallest values condition.
Exercise1
Rainfall (mm) season
500
300
1000
250
700
150

 Use if statement to comment on the above data as


follow:
Rainfall <=300mm season= Dry
Rainfall<=200mm season= very dry
Rainfall>300 mm season= Semi-Dry
Rainfall>500 mm season= Wet
Rainfall>750 mm season= Very wet
Exercise 2
 The following data are compressive test results for concrete
samples:
Specimen Cross sectional size
1 2 3 4 5 6
No Length 150 mm
Force (KN) Width 150 mm
630 562 405 855 540 610

• For each specimen find compressive strength=(Force*1000) / Area


• Area = Length * Width
• Use If statement to comment on calculated compressive strength as
follow:

Compressive strength >35 (Unreasonable)


Compressive strength (24-35)(Pass)
Compressive strength<24 (Fail)
Formatting
Numbers

 If you want all numbers in a cell range to appear with a


specified decimal place
 If you want large numbers to have 1000 separator e.g.
10,000,000
 Select the cell range
 From home tab, cell group, go to Formatting then cell
formatting
Formatting numbers

Specify
Tick to
number of
have 1000
digits after
separator
decimal
Currency
 Select a cell range
 To format currency go to Home-Cell-Format-Format
cells

Select the
currency
you are
using
Date
 Different formats are available for dates
 Select a cell range
 Go to Home-Cells-Format-Cell format-Date

Choose a format here


Charts
Types of charts
 There are many chart types available in Excel. In this
course, the following types of charts are taken:
1. Scatter
2. Line
3. Column
4. Pie
Scatter (1)

 This type of charts is known as xy charts.

 Used to draw values of two variables against each other.

 Usually, lab measurements are drawn using scatter charts.


Scatter (2)
 Click in an empty cell
 Go to Insert tab, Chart group, Scatter and click on its
arrow, select a type
In Microsoft 2013

In Microsoft 2010

Right click on the


inserted chart area
Scatter chart- Selecting Data
Click on
to select
Write series name
x-data

Click on
to select
y-data

Select data then click on


Exercise
 Draw the following points and find a suitable relationship
between them.

x y
1 2
2 4
3 8
4 16
5 32
Line, Column and Pie chart
 Line charts are used to show trend of a phenomenon
over time
 Column charts are usually used to compare two or more
data series together
 Pie charts are used to show shares of different
components of data
Examples of line, pie and column charts

Water consumption

Domestic use
20%
35%
Agricultural
demand
45% Industrial
demand
Creating line, column and pie charts
 To create any of line, column and pie chart:
 Select the data to be charted
 Go to Home tab, chart group and select one of the above
types.
Labels
 To label a chart , first select the chart
 When the chart is selected, a new tab “Layout” appears
 Go to Layout tab, Labels group

In Microsoft 2010

To show
Labeling x data values
and y axes In Microsoft
2013 click on
the chart
then click on
the plus sign
(+)
Adding/Removing gridlines
 You can add/remove vertical and horizontal gridlines.
 To do so, select a chart, go to “Layout” tab, Axes, Gridlines

*In Microsoft 2013 click on the chart then


click on the plus sign (+) then tick Gridlines
Formatting major/minor axes units in
Microsoft 2010
 Select the chart, from layout tab go to Axes group, Axes:
• Select the axes you want to format (Horizontal/vertical)
• Go to More Axes options
Formatting major/minor axes units in
Microsoft 2013
 Select the chart, from Design tab go to Add chart element
then Axes, more axis options.
• Select the axes you want to format (Horizontal/vertical)
• Go to More Axes options
Formatting major/minor axes units (2)
In Microsoft 2010
In Microsoft 2013
Exercise (Column chart )
Use column chart to compare the following set of data.
Flexural
Sample
strenghth(Mpa)
7 days 0% 3.9
5% 3.5
10% 3.1
15% 3.4
28 days 0% 4.5
5% 4.1
10% 3.5
15% 3.7
Select the series
name (7 days)

Select series values


(Flexural strength for 7days)
 Repeat these steps for 28 days series.
The chart will be as follow:

5.0

4.5

4.0
Flexural strength (Mpa)

3.5

3.0

2.5
7 days
2.0 28 days
1.5

1.0

0.5

0.0
0% 5% 10% 15%
Samples
Exercise (Scatter Chart)
 Draw a graph for y=x^2 using scatter chart.

Note:
 In a column insert some values for x starting from 0-10
 Calculate y
 Now you can chart them
 Add axis titles to the chart
 Show major and minor horizontal and vertical gridlines
 Change the major unit of horizontal axis to 0.5
Adding trend line in Microsoft 2010
 Trend line are the best fit curves
 Excel has ability of providing drawn data with an equation
that fits data.
 To draw a trend line, select the chart, go to Layout tab,
Analysis group, trend line, More trend line options
Choosing a trend line
 There is a number of trend line alternatives.
 There is no rigid guideline to choose a type,
 You will try one by one until you find the best one for
your data.

 You can choose to display R^2 with each trend line.


 R^2 is a statistical parameter <1
 As much as R^2 is close to 1 then the trend line
represents data better.
Displaying equation and R^2
• It is possible to display equation and R^2 when adding a
trend line.
• To do that in the trend line dialogue window , you must
check their options.
Exercise
 Water height and discharge measurements for a
rectangular weir are tabulated. Graph them and find an
equation to represent their relationship.
Water Discharge
depth (l/s)
(mm)
• Put all the useful labels and titles
• Set major unit for horizontal axis to be 10
19.2 136 • Set major unit for vertical axis to be 50
30 271 • Display vertical major gridlines
39.2 402 • Add a linear trend line
50.5 603
58.5 756

You might also like