Lec 4
Lec 4
Lecture 4:
Microsoft Excel combines the column-row layout of traditional paper spread sheets with
powerful tools for data calculation, analysis, and formatting.
Opening Excel
1. To open Excel 2010, from the Start menu, select All Programs » Microsoft Office »
Microsoft Office Excel 2010
Workbook
A collection of worksheets contained within a single file.
Worksheet
single sheet within the workbook.
A worksheet can contain data, charts, or both.
Instead of compiling all of your information into one worksheet, you can
create several worksheets within the one workbook file.
Column
A vertical group of cells within a worksheet.
Row
A horizontal group of cells within a worksheet.
Cell
The intersection of a column and row. Information is stored in cells.
Cell Address
Consisting of the column and row IDs, of a specific cell.
The current cell location is displayed in the upper left corner of the worksheet.
Cell Ranges :
A range in Excel is a collection of two or more cells.
1
2. Creating a Workbook
1. In the top left corner of the Excel window, click FILE menu.
From the File menu, select New… Blank workbook
The New Workbook dialog box appears.
2
First ,we will learn how to open a workbook,
how to create a workbook from a template and
how to view multiple workbooks at the same time
Open a Workbook
To open an Excel workbook you have created in the past, execute the following steps.
1. Click on the green File tab. The File tab in Excel 2010 replaces the Office Button (or File
Menu) in previous versions of Excel.
What you see next is called the backstage view and it contains all the workbook related
commands. Recent shows you a list of your recently used workbooks.
2. You can quickly open a workbook from here or you can click Open to open another
workbook that is not on the list.
3
Create a Workbook from a template
Instead of creating a workbook from scratch, you can create a workbook from a template.
There are many free templates available, waiting to be used!
2. To choose a template from one of the sample templates, click on Sample templates.
Result:
4
View Multiple Workbooks
If you want to view multiple workbooks at the same time, execute the following steps.
5
Result.
Note: to switch back to normal view, click on Arrange All again and check 'Windows of
active workbook'.
Save a Workbook
- specify the path of the file and type the name of the workbook
- select the save as type as 97-2003 format or excel workbook option
6
- click save
You can password protect a workbook when you want to be sure that only people who
know the password can open your Excel file.
7
5. Reenter the password and click on OK.
6. Click on Save.
When you share a file with other users, you may want to protect a worksheet to help
prevent it from being changed.
1. Right click on the worksheet tab of the worksheet you want to protect.
8
2. Click on Protect Sheet...
3. Enter a password.
4. Check the actions you allow the users of your worksheet to perform.
5. Click on OK.
Note: to unprotect a worksheet, right click on the worksheet tab again and click on
Unprotect Sheet..
9
3. Worksheet Manipulation
When you open Excel, Excel automatically selects Sheet1 for you. The name of the
worksheet appears on its sheet tab at the bottom of the document window.
1. To select one of the other two worksheets, simply click on the sheet tab of Sheet2 or
Sheet3.
By default, the worksheets are named Sheet1, Sheet2 and Sheet3. To give a worksheet a
more specific name, execute the following steps.
2. Choose Rename.
10
3. For example, type Sales 2010.
Result:
You can insert as many worksheets as you want. To quickly insert a new worksheet, click
the Insert Worksheet tab at the bottom of the document window.
Result:
To move a worksheet, click on the sheet tab of the worksheet you want to move and drag it
into the new position.
1. For example, click on the sheet tab of Sheet4 and drag it before Sheet2.
11
Result:
Result:
Imagine, you have got the sales for 2010 ready and want to create the exact same sheet for
2011, but with different data. You can recreate the worksheet, but this is time-consuming.
It's a lot easier to copy the entire worksheet and only change the numbers.
12
The 'Move or Copy' dialog box appears.
4. Click on OK.
Result:
13
Unhide
4. Cell Manipulation
Data type refers to the characteristics of the information stored in a worksheet cell.
For the purposes of this introductory, the main types of data in Excel:
Text
Numbers
14
Text data
It is most often words that are used for worksheet headings, names, and for
identifying columns of data.
Text data can contain letters numbers, and specialty characters such as ! or &. By
default, text data is left aligned in a cell.
Numbers
Problems can arise if numbers get stored as text data. This can prevent them from being
used in calculations.
Formulas:
15
2. Select the cell where you want the first cell of the range to appear, right click, and click on
Paste under the 'Paste Options:' group.
Note: the other Paste Options are not important at this stage, but you can have a go with it
if you want.
To insert a row between the values 20 and 40 below, execute the following steps.
2. Click on Insert.
16
Result:
The rows below the new row are shifted down. In a similar way, you can insert a column.
Click on the cell, type over the existing entry, and press the ENTER key on the keyboard.
Method 1
17
Method 2
Home key: moves the active cell highlight to column A without changing rows.
Ctrl + Home keys: moves the active cell highlight to cell A1.
Ctrl + End keys: moves the active cell highlight to the last cell of the spreadsheet
containing data.
Ctrl + Down Arrow keys: moves the active cell highlight to the last row of the
spreadsheet without changing columns.
Ctrl + Up Arrow keys: moves the active cell highlight to the first row of the
spreadsheet without changing columns.
Ctrl + Page Down keys: moves the active cell highlight to the next sheet of the
spreadsheet.
Ctrl + Page Up keys: moves the active cell highlight to the previous sheet of the
spreadsheet.
1. Modify Fonts
Modifying fonts in Excel will allow you to emphasize titles and headings. To modify a font:
Select the cell or cells that you would like the font applied
On the Font group on the Home tab, choose the font type, size, bold, italics,
underline, or color
18
Comma Formatting in Excel
19
There are several tabs on this dialog box that allow you to modify properties of the cell or
cells.
Number : Allows for the display of different number types and decimal places
Alignment : Allows for the horizontal and vertical alignment of text, wrap text,
shrink text, merge cells and the direction of the text
Font : Allows for control of font, font style, size, color, and additional
features
Border : Border styles and colors
Fill : Cell fill colors and styles
Borders and colors can be added to cells manually or through the use of
styles. To add borders manually:
Click the Borders drop down menu on the Font group of the Home tab
Choose the appropriate border
Click the Fill drop down menu on the Font group of the Home tab
Choose the appropriate color
20
To apply borders and colors using styles:
Click the Format button on the Cells group of the Home tab
Manually adjust the height and width by clicking Row Height or Column Width
To use AutoFit click AutoFit Row Height or AutoFit Column Width
21
5. Hide or Unhide Rows or Columns
To hide or unhide rows or columns:
22
6. Merge Cells
To merge cells select the cells you want to merge and click the Merge & Center
button on the Alignment group of the Home tab. The four choices for merging
cells are:
Combines the cells and centers the contents in the new, larger cell
Merge Across: Combines the cells across columns without centering data
Merge Cells: Combines the cells in a range without centering
Unmerge Cells: Splits the cell that has been merged
To align cell contents, click the cell or cells you want to align and click on the
options within the Alignment group on the Home tab. There are several options
for alignment of cell contents:
23
Date Formatting in Excel
When finished, Click OK at the bottom of the Format Cells dialog box.
9. Percentage Format
2. On the Home tab, in the Number group, click the Percentage symbol.
24
Result:
You can use data validation to make sure that users enter certain values into a cell. Input
messages can be used to tell the user what to enter. If users ignore this message and enter a
value that is not valid, you can show them an error alert.
25
1. Open the Excel file.
Input Message
Input messages appear when the user selects the cell (in this example, selects cell
C2) and tell the user what to enter.
On the Input Message tab:
1. Check 'Show input message when cell is selected'.
26
2. Type a title.
3. Type an Input message.
Error Alert
If users ignore the input message and enter a number that is not valid, you can
show them an error alert.
On the Error Alert tab:
1. Check 'Show input message when cell is selected'.
2. Type a Title
3. Enter an error message.
27
Result when you enter a number that is not valid.
You can create all sorts of other data validation rules for cells.
5. Printing in Excel
To print the entire worksheet or just a selection and how to change some important
print settings, such as fitting a sheet on one page, printing gridlines and headings,
adjusting page margins, and centering a range of cells on a page automatically.
Print a Worksheet
To print a worksheet in Excel 2010 (or Excel 2007), execute the following steps.
1. On the File tab, click Print.
2. To preview the other pages that will be printed, click 'Next Page' or 'Previous
Page' at the bottom of the window.
28
3. To print the worksheet, click the big Print button.
Print Selection
Instead of printing the entire worksheet, you can also only print the current selection.
1. First, select the range of cells you want to print.
2. Next, under Settings, select Print Selection.
29
3. To print the selection, click the big Print button.
30
Print Gridlines & Headings
Printing gridlines (the horizontal and vertical lines you see on your worksheet) and
row/column headers (1, 2, 3 etc and A, B, C etc) makes your copy easier to read. To
print gridlines and headings, execute the following steps,
1. On the Page Layout tab, check Print under Gridlines and check Print under Headings.
Page Margins
To adjust the page margins, execute the following steps.
1. First, click on the 'Show Margins' icon at the bottom right window.
2. Next, you can drag the lines to change the page margins.
31
Center on Page
To center a range of cells on a page automatically, execute the following steps.
1. Under Settings, select 'Custom Margins' from the Margins drop-down list.
32
2. Next, check horizontally and vertically.
One new feature that comes with Excel 2010, is the ability to save files in PDF format. The
PDF (Portable Document Format) allows others to view your Excel spreadsheets without
having Excel installed on their computer.
You can download the accompanied Excel file if you like. Let's get started!
To save files in PDF format in Excel 2007, you can download the 2007 Microsoft Office Add-
in. To save an Excel file in PDF Format in Excel 2010, execute the following steps.
33
4. Select 'Minimum size' if you want to keep the file size as small as possible.
5. Click on Options.
5. Here you can select which sheets you want to publish. By default, all pages of the Active
sheet will be published.
Excel automatically opens the PDF file for you (unless you deselected the 'Open file after
publishing' checkbox earlier on).
34
7. Charting
Charts are graphic depictions of data in your worksheet. Excel can build a chart
automatically based on existing data, after which the chart can be moved, resized, and
deleted without affecting your worksheet data. Charts do not appear within a specific cell,
but rather appear over other cells. When creating a chart, there are some basic rules to keep
in mind to make the process easier. This document gives an overview of the necessary
elements of a chart.
Excel 2007 offers several types of charts, each with its own unique functions. Be sure to
choose the type of chart that best serves your purposes. The following table provides a
quick summary of all the chart types available to you, as well as their functions:
35
Doughnut Proportionally compares the items in two or more data
series
In Excel, charts are visual representations of data on a spreadsheet. There are many types of
charts available, so you should find one that is right for your project.
36
The following list describes the various elements in this chart.
Title
Identifies the data being charted on the horizontal x-axis; values in this section will
be used as labels along the x-axis.
EXAMPLE: Cities (Minneapolis, Albuquerque, Tampa)
Identifies the data being charted on the vertical y-axis; values in this section will
determine where points fall in relation to the y-axis.
NOTE: The x-axis can also be used as a value axis.
EXAMPLE: Average temperatures (0–90)
37
Legend
Identifies the information being charted. This is especially important when you have
more than one type of information charted.
Using the example of the above chart, the legend identifies which information
relates to each month.
Ticks
Ticks, indicating measurement increments, appear on both the y-axis and x-axis and
can help improve the readability of a chart. Both y-axis and x-axis ticks are optional.
Origin
The origin is the point where the x-axis and y-axis meet. The origin is generally at
zero (0) but can be modified.
8. Function
1. ABS
Returns the absolute value of a number. The absolute value of a number is the
number without its sign.
Syntax
ABS(number)
3. EXP
Returns e raised to the power of number. The constant e equals 2.71828182845904,
the base of the natural logarithm.
Syntax
EXP(number)
38
Formula Description (Result)
=EXP(1) Approximate value of e (2.718282)
=EXP(2) Base of the natural logarithm e raised to the power of 2 (7.389056)
4. FACT
Returns the factorial of a number. The factorial of a number is equal to 1*2*3*...*
number.
Syntax
FACT(number)
Formula Description (Result)
=FACT(5) Factorial of 5, or 1*2*3*4*5 (120)
=FACT(1.9) Factorial of the integer of 1.9 (1)
5. LOG
Returns the logarithm of a number to the base you specify.
Syntax
LOG(number, [base])
6.Mod
Returns the remainder after number is divided by divisor. The result has the same
sign as divisor.
Syntax
MOD(number, divisor)
7.PI
Returns the number 3.14159265358979, the mathematical constant pi, accurate to 15
digits.
Syntax
PI()
Formula Description (Result)
=PI() Pi (3.14159265358979)
39
=PI()/2 Pi/2 (1.570796327)
8. Power
Returns the result of a number raised to a power.
Syntax
POWER(number, power)
Formula Description (Result)
=POWER(5,2) 5 squared (25)
9. Product
The PRODUCT function multiplies all the numbers given as arguments and returns
the product.
Syntax
PRODUCT(number1, [number2], ...)
Data
5
15
30
Formula Description Result
=PRODUCT(A2:A4) Multiplies the numbers in cells A2 2250
through A4.
10.RAND
Returns an evenly distributed random real number greater than or equal to 0 and
less than 1. A new random real number is returned every time the worksheet is
calculated.
Syntax
RAND()
40
=SIGN(10) Sign of a positive number (1)
=SIGN(4-4) Sign of zero (0)
=SIGN(-0.00001) Sign of a negative number (-1)
12. SQRT
Returns a positive square root.
Syntax
SQRT(number)
A B
Data
-16
Formula Description (Result)
=SQRT(16) Square root of 16 (4)
=SQRT(A2) Square root of the number above. Because the number is
negative, an error is returned (#NUM!)
13. SUM
The SUM function adds all the numbers that you specify as arguments. Each
argument can be a range, a cell reference, an array, a constant, a formula, or the
result from another function.
Syntax
SUM(number1,[number2],...])
A B C
Data
-5
15
30
'5
TRUE
Formula Description Result
=SUM(3, 2) Adds 3 and 2. 5
41
MATRIX Operation
14. MMULT
Returns the matrix product of two arrays. The result is an array with the same
number of rows as array1 and the same number of columns as array2.
Syntax
MMULT(array1, array2)
A B
1 Array 1 Array 1
2 1 3
3 7 2
4 Array 2 Array 2
5 2 0
6 0 2
7 Formula Formula
8 =MMULT(A2:B3,A5:B6)
15. MINVERSE
Returns the inverse matrix for the matrix stored in an array.
Syntax
MINVERSE(array)
A B
Data Data
4 -1
2 0
Formula Formula
=MINVERSE(A2:B3)
2. Statistical function
1. Average
Returns the average (arithmetic mean) of the arguments
Syntax
AVERAGE(number1, [number2], ...)
Formula Description Result
=AVERAGE(A2:A6) Average of the numbers in cells A2 through A6. 11
42
2. Count
The COUNT function counts the number of cells that contain numbers, and counts
numbers within the list of arguments..
Syntax
COUNT(value1, [value2], ...)
A B C
Data
Sales
12/8/2008
19
22.24
TRUE
#DIV/0!
Formula Description Result
=COUNT(A2:A8) Counts the number of cells 3
that contain numbers in cells
A2 through A8.
3. Countif
The COUNTIF function counts the number of cells within a range that meet a single
criterion that you specify.
Syntax
COUNTIF(range, criteria)
43
=COUNTIF(A2:A5,"apples") Number of cells with 2
apples in cells A2
through A5.
4. Large
Returns the k-th largest value in a data set.
Syntax
LARGE(array, k)
The LARGE function syntax has the following arguments:
Array Required. The array or range of data for which you want to determine the
k-th largest value.
K Required. The position (from the largest) in the array or cell range of data to
return.
A B
Data Data
3 4
5 2
3 4
5 6
4 7
Formula Description (Result)
=LARGE(A2:B6,3) 3rd largest number in the
numbers above (5)
5. MAX
Returns the largest value in a set of values.
Syntax
MAX(number1, [number2], ...)
Formula Description (Result)
=MAX(A2:A6) Largest of the numbers
6. Min
Returns the smallest number in a set of values.
Syntax
MIN(number1, [number2], ...)
Formula Description (Result)
=MIN(A2:A6) Smallest of the numbers
44
7. Median
Returns the median of the given numbers. The median is the number in the
middle of a set of numbers. All the numbers should be arranged in ascending
order.
Syntax
MEDIAN(number1, [number2], ...)
The MEDIAN function syntax has the following arguments:
Number1, number2, ... Number1 is required, subsequent numbers are optional.
1 to 255 numbers for which you want the median.
Formula Description (Result)
=MEDIAN(A2:A6) Median of the first 5 numbers in the list above (3)
8. Small
Returns the k-th smallest value in a data set. Use this function to return values with
a particular relative standing in a data set.
Syntax
SMALL(array, k)
The SMALL function syntax has the following arguments:
Array Required. An array or range of numerical data for which you want to
determine the k-th smallest value.
K Required. The position (from the smallest) in the array or range of data to
return.
Formula Description (Result)
=SMALL(A2:A10,4) 4th smallest number
1. Date
The DATE function returns the sequential serial number that represents a
particular date. For example, the formula
=DATE(year,month,day)
Formula Description Result
=DATE(2008,1,1) Serial date for the date derived by using cells A2, B2, 1/1/2008
and C2 as the arguments for the DATE function, and
using the 1900 date system.
2. Now
45
NOW()
3.Day,Month,Year
Returns the day, month and year corresponding to a date.
Syntax
DAY(serial_number)
MONTH(serial_number)
YEAR(serial_number)
A B
Date
15-Apr-2008
Formula Description (Result)
=DAY(A2) 15
=month(A2) 4
=year(A2) 2008
4. Today
Returns the serial number of the current date.
example, if you know that someone was born in 1963, you might use the following formula
to find that person's age as of this year's birthday:
=YEAR(TODAY())-1963
Syntax
TODAY()
A B
Formula Description
=TODAY() Returns the current date.
=TODAY()+5 Returns the current date plus 5
days. For example, if the current
date is 1/1/2008, this formula
returns 1/6/2008.
=DATEVALUE("1/1/2030")- Returns the number of days
TODAY() between the current date and
1/1/2030.
5. Time
Returns the decimal number for a particular time.
Syntax : TIME(hour, minute, second)
Example
=time(12,5,3) returns 12:05 P
46
9. PIVOT Table
A PivotTable is a powerful tool to calculate, summarize, and analyze data that lets
you see comparisons, patterns, and trends in your data.
The user have a lot of data, it can sometimes be difficult to analyze all of the
information in the worksheet.
PivotTables can help make the worksheets more manageable by summarizing data
and allowing you to manipulate it in different ways.
Input Data
Question
What is the amount sold by each salesperson?
47
Once you've created a PivotTable, you can use it to answer different questions by
rearranging—or pivoting—the data. ‘
For example, if we wanted to answer the question:
What is the total amount sold in each month? we could modify our PivotTable to look
like this:
To create a PivotTable:
Select the table or cells (including column headers) containing the data you want to
use.
48
1. The Create PivotTable dialog box will appear. Choose your settings, then
click OK. In our example, we'll use Table1 as our source data and place the
PivotTable on a new worksheet.
3. Once you create a PivotTable, you'll need to decide which fields to add.
49
Each field is simply a column header from the source data. In
the PivotTable Field List, check the box for each field you want to add.
In our example, we want to know the total amount sold by each salesperson,
so we'll check the Salesperson and Order Amount fields.
4. The selected fields will be added to one of the four areas below the Field List.
In our example, the Salesperson field has been added to the Rows area, while
the Order Amount has been added to the Values area. Alternatively, you can
click, hold, and drag a field to the desired area.
50
5. The PivotTable will calculate and summarize the selected fields. In our
example, the PivotTable shows the amount sold by each salesperson.
Just like with normal spreadsheet data, you can sort the data in a PivotTable using
the Sort & Filter command in the Home tab.
You can also apply any type of number formatting you want. For example, you may
want to change the Number Format to Currency. However, be aware that some
types of formatting may disappear when you modify the PivotTable.
If you change any of the data in your source worksheet, the PivotTable will not
update automatically.
To manually update it, select the PivotTable and then go to Analyze > Refresh.
51
Pivoting data
One of the best things about PivotTables is that they can quickly pivot—or
reorganize—data, allowing you to look at your worksheet data in different ways.
Pivoting data can help you answer different questions and even experiment with the
data to discover new trends and patterns.
What is the total amount sold by each salesperson? But now we'd like to answer a
new question:
What is the total amount sold in each month? We can do this by simply changing
the field in the Rows area.
1. Click, hold, and drag any existing fields out of the Rows area. The field will
disappear.
2. Drag a new field from the Field List into the Rows area. In our example, we'll
use the Month field.
52
3. The PivotTable will adjust—or pivot—to show the new data. In our example,
it now shows the total order amount for each month.
53
To add columns:
So far, our PivotTable has only shown one column of data at a time. In order to
show multiple columns, you'll need to add a field to the Columns area.
1. Drag a field from the Field List into the Columns area. In our example, we'll
use the Region field.
2. The PivotTable will include multiple columns. In our example, there is now a
column for each region.
54
Filters
Sometimes you may want focus on just a certain section of your data.
Filters can be used to narrow down the data in your PivotTable, allowing you to
view only the information you need.
To add a filter:
In our example, we'll filter out certain salespeople to determine how they affect the total
sales.
1. Drag a field from the Field List to the Filters area. In this example, we'll use
the Salesperson field.
2. The filter will appear above the PivotTable. Click the drop-down arrow, then
check the box next to Select Multiple Items.
55
3. Uncheck the box for any items you don't want to include in the PivotTable. In
our example, we'll uncheck the boxes for a few different salespeople, then
click OK.
56
Slicers
Slicers are basically just filters, but they're easier and faster to use, allowing you to
instantly pivot your data.
If you frequently filter your PivotTables, you may want to consider using slicers
instead of filters.
To add a slicer:
3. A dialog box will appear. Select the desired field. In our example, we'll
select Salesperson, then click OK.
57
4. The slicer will appear next to the PivotTable. Each selected item will be
highlighted in blue. In the example below, the slicer contains a list of all
salespeople, and six of them are currently selected.
5. Just like filters, only selected items are used in the PivotTable. When
you select or deselect items, the PivotTable will instantly reflect the changes.
58
Try selecting different items to see how they affect the PivotTable. Press and
hold the Ctrl key on your keyboard to select multiple items from a slicer.
You can also click the Filter icon in the top-right corner to select all items from the slicer at
once.
PivotCharts
PivotCharts are like regular charts, except they display data from a PivotTable.
Just like regular charts, you'll be able to select a chart type, layout, and style that will
best represent the data.
To create a PivotChart:
In this example, our PivotTable is showing each person's total sales per month. We'll use a
PivotChart so we can see the information more clearly.
59
2. From the Insert tab, click the PivotChart command.
3. The Insert Chart dialog box will appear. Select the desired chart
type and layout, then click OK.
60
Try using slicers or filters to change the data that is displayed. The PivotChart will
automatically adjust to show the new data.
61
Exercise!
1. Open an existing Excel workbook. If you want, you can use our practice
workbook.
2. Create a PivotTable using the data in the workbook.
3. Experiment by placing different fields in the rows and columns areas.
4. Filter the report with a slicer.
5. Create a PivotChart.
6. If you are using the example, use the PivotTable to answer the question, Which
salesperson sold the lowest amount in January? Hint: First decide
which fields you need in order to answer the question.
62
Questions
1. You can use the formula pallette to
2. Which tool you will use to join some cells and place the content at the middle of
joined cell?
A) From Format Cells dialog box click on Merge Cells check box
B) From Format Cells dialog box select the Centered alignment
C) From Format Cells dialog box choose Merge and Center check box
D) Click on Merge and Center tool on formatting toolbar
4. Each excel file is a workbook that contains different sheets. Which of the following
can not be a sheet in workbook?
A) work sheet
B) chart sheet
C) module sheet
D) data sheet
5. Which of the following is not the correct method of editing the cell content?
A) Press the Alt key
B) Press the F2 key
C) Click the formula bar
D) Double click the cell
6. What happens when you press Ctrl + X after selecting some cells in Excel?
A) The cell content of selected cells disappear from cell and stored in clipboard
B) The cells selected are marked for cutting
C) The selected cells are deleted and the cells are shifted left
D) The selected cells are deleted and cells are shifted up
63
B) Double click on the cell pointer in worksheet
C) Double clicking on column right border on column header
D) Double clicking on the column left border of column header
8. Long text can be broken down into many lines within a cell. You can do this through
9. Which of the following you can paste selectively using Paste Special command?
A) Validation
B) Formats
C) Formulas
D) All of above
A) Protect Sheet
B) Protect Workbook
C) Protect Workspace
D) All of above are valid
11. Number of rows and column in excel is ____________ and __________
12. Default number of worksheet in workbook is ____________
13. The extension of excel file is ______________
14. Graphical representation of object in excel is ___________
Write Answer
64