CHAPTER 5 - Data Analysis Using MS Excel 2007
CHAPTER 5 - Data Analysis Using MS Excel 2007
Chapter-5
182
Computer literacy Program… Data Analysis using MS Excel
Introduction to excel
Microsoft Excel is a spreadsheet application developed by Microsoft. It features calculation, graphing
tools, pivot tables, data analyzing etc. Microsoft Excel 2007 has a completely redesigned user interface.
The standard menus along the top have been removed and replaced with a series of toolbars Microsoft
calls ―The Ribbon.‖ These tool bars are changed using tabs at the top and try to automatically adjust
themselves to the content you are working with.
Save as
The save as option will provide you with the
most common file formats to save your
document in. The common ones are Excel
Workbook, Excel Macro-enabled
Workbook, Excel Binary Workbook, and
Excel 97-2003 Workbook. The last one is
the option most people should be using currently, especially if they wish to share documents with others
who do not have the new version of Office.
183
Computer literacy Program… Data Analysis using MS Excel
Print
Here you can choose from Print, Quick Print and Print Preview. Print brings up the standard print dialog
box, quick print will print one copy without any dialog box coming up and print preview will bring up the
print preview screen.
Prepare
The prepare menu’s most common options are Properties, Inspect Document, Mark as Final and Run
Compatibility Checker. The properties option allows you to setup metadata for the document like Author,
Title, keywords, comments and others. Inspect Document will scan the document for any hidden data like
comments and annotations, and any hidden collaboration data. This is very useful when making a
previously private document public. It will help you find any comments or changes made previously that
should not be made public. Mark as Final will mark the document as a final copy and make it read only
so changes cannot be made. The last common item, Run Compatibility Checker will scan the document
for new features that were used and show you these. This is recommended if you where creating a
document in the new file format but now need to convert it back to the Office 2003 format to share with
someone who does not have Office 2007.
The home tab the basic formatting tools found in Excel 2007. You will find seven sections, Clipboard,
Font, Alignment, Number, Styles, Cells and Editing. Clicking the down arrow beside any of the icons
here will drop down more options for that tool. Each section also contains an arrow in the bottom right
corner which will open a window containing the options found in that section.
Clipboard
The Clipboard allows you to cut, copy, paste and copy formatting from one place to
another.
Font
The font section of the ribbon provides a section to handle
the basic text formatting. Items such as bold, underline,
184
Computer literacy Program… Data Analysis using MS Excel
strikethrough, highlight and font type can be changed here. Some items from this section and some items
from the number section are also available by right clicking a cell. This saves having to move your cursor
all the way to the top of the screen for some common formatting items.
Alignment
The alignment section provides icons to justify, Vertical alignment, indents,
text wrap, merge cells and centre text and text orientation.
Number
The number section provides the options for formatting numbers. You can choose the
type of number, like date, currency, percentage, fraction or general. You can also increase
or decrease the number of decimal places shown.
Styles
The styles section allows you to quickly change the formatting of a section of
cells by choosing one of the predefined styles. You can choose different types of
conditional formatting, table formatting or cell styles. These are used to change the visual appearance of a
section to quickly show what is being displayed in an area.
Cells
This section allows you to insert of delete cells, rows, columns, or sheets. You can also
format the height or width of columns and rows, hide or unhide elements, organize or
protect cells and sheets. There are a lot of features in this section under the format option.
Editing
The editing section gives you options for inserting functions, filling formulas across
185
Computer literacy Program… Data Analysis using MS Excel
cells, clearing formatting and formulas, sorting and finding. Again, there is a large number of options in
this area. These options are also included in the image to left.
Insert Tab
The insert tab has five sections for inserting most types of objects. The sections are tables, illustrations,
charts, links, text and symbols.
Tables
The tables section has an option for pivot tables and charts and tables. You can select
an area and turn it into a formatted table or pivot table with these options. Once you
have created your table there is another tab which becomes available to work with the table design. This
tab is shown below.
Table Design
Illustrations
The Illustrations section allows you to insert pictures, clipart, shapes, and SmartArt. After inserting or
selecting a picture you are provided with a new toolbar along the top shown here.
186
Computer literacy Program… Data Analysis using MS Excel
This toolbar gives you the ability to change the brightness, contrast, shape, position, text wrapping and
other options for the picture. Clicking off the picture or on one of the other tabs will take you back to the
standard toolbars. The Shapes option of the Illustrations section allows you to insert lines, arrows, boxes,
basic flowchart shapes and a number of others. The SmartArt option provides features like org charts,
flow charts, illustrated lists and processes. The Chart option is similar to Excel 2003 but it offers more
options for your charts.
Charts
The charts section provides drop down menus to insert different
types of column, line, pie, bar, area, scatter and other types of charts. Once you create a chart you will get
three additional tabs to work with your chart. They are shown below.
Links
187
Computer literacy Program… Data Analysis using MS Excel
The links section provides options for inserting hyperlinks to your spreadsheet.
Text
Options in the text section include text box, header and footer,
WordArt and a number of predefined text blocks like a signature line
and symbols. There are a lot of option in here to setup on your own or you can use Excel’s predefined
options.
The page layout tab has five sections, Themes, Page Setup, Scale to Fit, Sheet Options, and Arrange.
Themes
The themes section provides a quick way to format your document. By choosing a
theme you will have a set colour scheme, font combinations, and effects. You can
choose one of the provided themes, modify any provided theme or create your own. You can also go
online in this section and browse Microsoft.com for additional themes. Be aware that changing your
theme after creating a document may require you to reformat some items as themes also include some
layout options.
Page Setup
Page setup provides you with the tools to change
margins, size, orientation, columns, breaks,
backgrounds and add print titles to the document.
Scale To Fit
This section allows you to scale to fit your document onto a certain number of
pages or to scale it to a certain percentage of it’s current size.
188
Computer literacy Program… Data Analysis using MS Excel
Sheet Options
This section gives you checkboxes to view or print headings and gridlines.
Arrange
The arrange section is also found in the image toolbar when an image is selected.
Here you can change an images position, the alignment, grouping and rotation or
the image.
Formulas Tab
The formulas tab contains four sections, function library, defined names, formula auditing and calculation.
Function Library
This section gives you access to the large number of predefined
Excel functions. There are Auto Sum functions, financial, logical, text, date and time, lookup and
reference, math and trig, and additional functions. It also provides a section for recently used functions so
you can get back to the ones that you use the most quickly.
Defined Names
The defined names section allows you to create names or variables to be
referenced in other areas. This would be like assigning ―taxrate‖ to cell b2
so in a formula you can easily see what you were referencing when you look at a formula months after
creating it. The formula =A10*taxrate means more later than =a10*b2
Formula Auditing
This section provides tools to manage formulas to ensure that they are
correct. You can use the tools here to find out what cells your formula
189
Computer literacy Program… Data Analysis using MS Excel
depends on, what cells depend on the current cell, and show the formula in a cell instead of the resulting
value. There is also a tool for error checking which will look for common errors in formulas.
Calculation
Here you can turn on or off automatic calculation from formulas. If you turn off
automatic calculations you can use this area to calculate the current cell or the whole
sheet.
Data Tab
The data tab contains five sections, get external data, connections, sort and filter, data tools, and outline.
Connections
Here is where you manage any connections to outside sources. The setup done
here is what allows you to pull data from the external sources listed above.
190
Computer literacy Program… Data Analysis using MS Excel
Data Tools
With the data tools section you can take text and turn it into columns,
remove duplicates, check your data to make sure it is valid based on
different criteria. Are they all whole numbers? Are they all properly formatted dates? You can also
consolidate data or do ―What if‖ analysis where you can check you data against different scenarios.
Outline
The final section in the data tab provides tools to group or ungroup rows or columns
and obtain subtotals for grouped items.
Review Tab
The review tab offers three sections which include proofing, comments, and changes.
Proofing
The proofing section provides the standard spelling and grammar check, a
thesaurus, and research tools that include MSN search and Microsoft Encarta encyclopedia. You will also
find translation tools to help with single words or the whole document. The translation of the entire
document is done by an online service called Wordlingo.
Comments
The comments section allows you to add comments to a
document for easier collaboration. You can cycle through the comments to find out what notes you left
for yourself or others and you can delete a comment that was made when it is no longer relevant.
191
Computer literacy Program… Data Analysis using MS Excel
Changes
The changes section allows you to protect a sheet or the
entire workbook, you can also share a workbook. Some of the sharing features are only available to users
on a Windows domain. This authenticates the users against the domain for access so this will not work
for many people.
View Tab
The view tab offers five sections which include workbook views, show/hide, zoom, window and macros.
Workbook Views
The workbook views section switches your display between normal
view, page layout, full screen and page break preview. The page layout
will show you what will be on each page and provide a way to add headers and footers to each page. The
page break preview will show you a scaled version of your spreadsheet with dotted lines showing where
the page breaks will be. There is also a way to work with custom views here.
Show/Hide
The show/hide section will toggle certain tools on or off the screen including
rulers, gridlines, message bar, formula bar and headings. The rulers will
show along the top and left side of the screen. Gridlines will show the grids around each cell. They will
be visible on screen but don’t print.
Zoom
The zoom section provides tools to zoom into or out of the document. You can
choose your own zoom factor or use the predefined zoom factor of 100% or you can select a section and
zoom so it fills your screen.
192
Computer literacy Program… Data Analysis using MS Excel
Window
The window section allows you to create a new window, arrange
your windows one on top of the other or split your window so the
same document is viewed in two screens one on top of the other. You can also hid and unhide a window.
Once you have arranged your windows the way you like them you can save the workspace so you can
open to this setup when you need to work on these items again. This is very handy for setups where you
need to work on multiple documents at once and you have to do this a lot. You can also choose which
window to work on through the switch windows drop down menu.
Macros
The macros section provides the tools required to work with and create basic macros. You can
view existing macros or record your own. Choose record macro from the drop down and then perform the
functions you do often, like change the page layout, and style of the document. Once you have done those
tasks then stop recording. You will be able to use that macro over again to shorten the steps you need to
take every time you need to perform that set of tasks.
Page setup
In the Excel 2007 Page Setup section of the page layout
tab the first button is Margins. Click the down arrow to
see the default selections. These are the margins that you
need to set for printing your document. set custom
margins by clicking the custom margins selection at the
bottom of the Margins button.
193
Computer literacy Program… Data Analysis using MS Excel
The next button in the Page Layout tab, page setup section is Size. This button will let you select
the size of the paper you will print your spreadsheet on. Printing small spreadsheets on note cards
for school exams is where I found this option most valuable.
Click the down arrow to see all of the page size options.
The 8.5” x 11” paper size is the default selection. use the scroll bar on the right had side of the
drop down menu to see more sizes or if you would like more options click the More Paper sizes
option at the bottom of the list.
Formula Basics
Formulas in Microsoft Excel begin with an equal sign. The equal sign tells Excel that the
succeeding characters constitute a formula. If you don't enter the equal sign, Excel will treat your
entry as text and the calculation will fail.
Order of Operation
Conditional Formatting
Conditional Formats respond to the contents of cells. They are almost always applied to group of
cells, often rows or columns of totals, if not entire tables.
194
Computer literacy Program… Data Analysis using MS Excel
Click Home Tab, locate the Style group and click on the downward arrow of Conditional
Formatting.
When you click on Highlight Cell Rules this method will keep the cells ―inactive‖ until the
values (numeric or text) contain the specific
rule you select the option : Greater Than,
Less Than Between, Equal To, Text that
Contains, A Date Occurring, and Duplicate
Values. Once you have selected a rule a
dialog box will appear where you may
specify the appropriate criteria.
1. Top Bottom: Selected formatting applied to all cells in a range that are greater than or less
than a given threshold. Click Top 10 Items, Top 10%,
Bottom 10 Items, Bottom 10%, Above Average, or
Below Average to display a dialog box where you can
specify the appropriate criteria.
3. Color Scales: Two-color or three-color formats whose color indicates the values in the cells
relative to all other adjacent cells formatted using the same conditions. Choose from a number of
different color combinations, based on the current theme.
4. Icon Sets: Sets of three, four, or five tiny graphic images placed inside cells whose shape or
color indicates the values in the cells relative to all other adjacent cells formatted using the same
conditions. Choose from a number of different types of icons
195
Computer literacy Program… Data Analysis using MS Excel
The organization of the formulas is new to Excel. formula dialog box appear on the Formula Tab.
Each formula is divided up among relevant general topic categories. The categories are listed
across the top of the Formula Tab group titled Function Library.
Excel formulas are used to make the data you have entered more useful. Through the use of
formulas you are able to, at a minimum, maintain finances, schedules, and detailed reports
Basic Formulas
Use the SUM function, which is prewritten formula, to add all the values in a row or column:
1. Click your mouse in the cell in which you wish your result to appear
2. Click the AutoSum button on the Home Tab or the Formulas Tab
4. Press Enter
2. Type or select the cell references you want to add. A comma (,) separates individual
arguments that tell the function what to calculate
1. Click your mouse in the cell in which you wish your result to appear
2. Click the arrow next to AutoSum on the Home Tab or the Formulas Tab.
196
Computer literacy Program… Data Analysis using MS Excel
4. Highlight the range of cells you wish to find the value for
5. Press Enter
To see more functions, click More Functions on the AutoSum list to open the Insert Function
dialog box OR go to the Formulas Tab and click on the More Functions orange textbook icon.
In this example we have a list of birthdays. Our objective with this data is to find out how many
birthdays occurred more than six months ago, and how many occurred five years ago. To start
we want to know todays date.
PRODUCT Function
The PRODUCT function provides a quick way to multiple numbers in a Excel. The advantage of
using this function becomes apparent if you have several numbers to multiply together. It is
easier then building a long formula.
SUMIF Function
197
Computer literacy Program… Data Analysis using MS Excel
The SUMIF function is used to add up the values in cells in a selected range that meet certain
criteria.
Sum Range - the data range that is summed if the first range meets the specified criteria. If this
ROUND Function
The ROUND function is used to reduce a given value to a specific number of decimal places.
Num_digits - the number of decimal places to reduce the above number to.
IF Function
The IF function, one of Excel’s logical functions, tests to see if a certain condition in a
spreadsheet is true or false.
198
Computer literacy Program… Data Analysis using MS Excel
VLOOKUP Function
Excel's VLOOKUP function, which stands for vertical lookup, is used to find specific
information that has been stored in a spreadsheet table.
Note: The data in the table should be sorted in ascending order (alphabetically A to Z).
lookup _value: The value you want to find in the first column of the table_array.
table_array: This is the table of data that VLOOKUP searches to find the information you are
after.
The table_array must contain at least two columns of data. The first column contains the
lookup_values.
col_index_num: The number of the column in the table_array that contains the data you want
returned.
range_lookup: A logical value (TRUE or FALSE only) that indicates whether you want
VLOOKUP to find an exact or an approximate match to the lookup_value. Typing False will
return exact matches only.
TRANSPOSE Function
The TRANSPOSE function, one of Excel's Lookup & Reference functions, is used to copy data
located in a
{ = TRANSPOSE ( Array )}
Array - the range of cells to be copied from the horizontal to the vertical or vertical to the
horizontal.
The curly braces " { } " surrounding the function indicate that it is an array function.
AVERAGE Function
199
Computer literacy Program… Data Analysis using MS Excel
The AVERAGE function, one of Excel's statistical functions, is used to find the average or
arithmetic mean of a given list of arguments. The syntax for the AVERAGE function is:
MAX Function
The MAX function, one of Excel's statistical functions, is used to find the largest or maximum
number in a given list of values or arguments. The syntax for the MAX function is:
Argument1 ... argument 30: The arguments can be numbers, named ranges, arrays, or cell
references.
MIN Function
The MIN function, one of Excel's statistical functions, is used to find the smallest or minimum
value in a list of numbers or arguments. The syntax for the MIN function is:
Argument1 ... argument 30: Arguments can be numbers, named ranges, arrays, or cell references.
Up to
COUNT Function
Excel's COUNT function is one of a group of Count Functions that can be used when you need to
total the number of cells in a selected range. The COUNT function's job is to only add up the
cells in a selected range that contain numbers. It ignores empty cells or those contain text. If a
number is later added to an empty cell the function will be automatically updated to include this
new data. Be aware that dates, times, functions, and formulas are stored as numbers in Excel. The
COUNT function will, therefore, include any cells containing these types of data in the total.
=COUNT( Range )
200
Computer literacy Program… Data Analysis using MS Excel
Step 1: Click the Header & Footer button in the Text group under Insert tab in Microsoft Excel
Step 2: Then it display the header editable area at the top of worksheet.
Enter the information want to show at the top of every printed page based on needs.
Step 3: When cursor stays in the header editable area, the Header & Footer Tools is active:
User can click the Header button and Footer button in the Header & Footer group to insert all
kinds of header and footer.
201
Computer literacy Program… Data Analysis using MS Excel
If user want to delete the Header from worksheet, user can click the Design >> Header >> none
under Header & Footer Tools. So does deleting the Footer.
Page Number button and Numbers of Pages button: Insert the page numbers in the
footer or header.
Current Date button and Current time button: Insert current time/date in the footer or
header.
File name button: Insert current workbook's name in the footer or header.
File Path button: Add the name of the current workbook, including the full saving path,
to the header or footer.
Sheet Name button: Add the name of current sheet to the header or footer.
Charts start with data. In Excel 2007, select data in worksheet, choose a chart type
use the new Chart Tools to customize the design, layout, and formatting of chart .look just by
pointing at them in the dialog box, even before you make a choice.
1. Select the cells containing the sales data, including cells with text (e.g. column and
row headings for the data.) In this example, the cells are A1:D4. (Yes; we also
include the blank cell, A1.)
202
Computer literacy Program… Data Analysis using MS Excel
Chart Elements
A chart has many elements. Some of these elements are displayed by default, others can be added
as needed.
You can change the display of the chart elements by moving them to other locations in the chart,
resizing them, or by changing the format. You can also remove chart elements that you do not
want to display
203
Computer literacy Program… Data Analysis using MS Excel
3. The data points are the individual values plotted in a chart and represented by bars, columns,
lines, pie or doughnut slices, dots, and various other shapes called data markers. Data markers of
the same color constitute a data series (i.e. related data points. You can plot one or more data
series in a chart, but pie charts have only one data series.
4. The horizontal (category) or vertical (value) axis is a line bordering the chart plot area used as
a frame of reference for measurement. The y-axis is usually the vertical axis and contains data.
The xaxis is usually the horizontal axis and contains categories.
5. A legend is a box that identifies the patterns or colors that are assigned to the data series or
categories in a chart.
6. A chart title is the descriptive text for a chart. Note that horizontal and vertical axes
usuallyhave titles too.
To create a chart in Excel, you start by entering/selecting the data for the chart. The data can be
arranged in rows or columns — Excel automatically determines the best way to plot the data in
the chart.
Some chart types (e.g. pie charts) require a specific data arrangement as described in the
following table.
Modifying charts
After you create a chart, you can modify it. For example, you may want to change the way that
axes are displayed, add a chart title, move or hide the legend, or display additional chart
elements.
To modify an element in the chart, you can right-click on it and choose the appropriate (format)
option.
Or, you can use the appropriate tabs, groups and options under Chart Tools.
Add titles to a chart: Chart Tools -> Layout -> Labels -> Chart Title
204
Computer literacy Program… Data Analysis using MS Excel
Add axis titles to a chart: Chart Tools -> Layout -> Labels -> Axis Title
Add legend to a chart: Chart Tools -> Layout -> Labels -> Legend
Add data labels to a chart: Chart Tools -> Layout -> Labels -> Data Labels
Add data table to a chart: Chart Tools -> Layout -> Labels -> Data Table
To change formatting and layout of each axes: Chart Tools -> Layout -> Axes ->Axes
To turn gridlines on or off: Chart Tools -> Layout -> Axes -> Gridlines
To format the plot area: Chart Tools -> Background -> Plot Area
To format the chart wall (for 3-D charts): Chart Tools -> Background -> Chart Wall
To format the chart floor (for 3-D charts): Chart Tools -> Background -> Chart Floor
To change 3D viewpoint of a chart: Chart Tools -> Background -> 3-D Rotation
To move chart to a different sheet: Chart Tools -> Design -> Location -> Move Chart
1. In cell B9, use Data Validation to select either January, February, or March.
Data -> Data Tools -> Data Validation -> Allow: List; Source: January, February,
March
205
Computer literacy Program… Data Analysis using MS Excel
2. In cell B10, B11, and B12, write the formulas as shown above.
206
Computer literacy Program… Data Analysis using MS Excel
Step 1: Click the Developer tab on the Ribbon at the top of the screen. If the
tab is not showing up on your screen, you can add it as follows:
For Excel 2010: click the File Tab then select options. On the left hand
side of the Excel options dialog box, click Customize Ribbon. Then, on the right
hand side box select Developer.
For Excel 2007: click the Microsoft Office button, then Excel Options.
In the Popular category, under Top Options for Working with Excel, select Show
Developer Tab in Ribbon.
207
Computer literacy Program… Data Analysis using MS Excel
Step 2: Change the security settings. In Trust Centre, Under Macro Settings,
clickEnable All Macros, then click OK.
208
Computer literacy Program… Data Analysis using MS Excel
Note that this security setting is not ideal for basic use. When you've
finished creating your macro, go back and un-click Enable All
Macros.
Step 3: Click Record Macro. You'll find it on the Developer tab under Code.
209
Computer literacy Program… Data Analysis using MS Excel
Step 4: Name your macro. The first character of the name must be a letter; after
that, you can use characters, numbers and underscores. Macro names cannot have
spaces.
Don't use the same name for your macro as an existing cell reference.
210
Computer literacy Program… Data Analysis using MS Excel
Step 5:
Set a shortcut for your macro (optional). Type a letter in the Shortcut Key box.
A lowercase letter will translate to CTRL + letter; an uppercase letter will be CTRL
+ SHIFT + letter.
211
Computer literacy Program… Data Analysis using MS Excel
Step 6: Choose where to store your macro. In the Store Macro In list, select the
workbook where you want to store the macro. If you want it to be available
whenever you run Excel, select Personal Macro Workbook.
Step 7:
Describe your macro. Write this in the Description box.
212
Computer literacy Program… Data Analysis using MS Excel
Step 8:
Click OK to start recording your macro.
213
Computer literacy Program… Data Analysis using MS Excel
214
Computer literacy Program… Data Analysis using MS Excel
Step 10: Stop recording. Go to the Developer tab, click Code, then click Stop
Recording.
215
Computer literacy Program… Data Analysis using MS Excel
What-If Analysis is an important aspect of planning and managing any business. Understanding the
implications of changes in the factors that influence your business is crucial when it comes to making
important business decisions. What would be the effect of an increase in your costs, or if turnover rose or fell
by a certain amount? How would a change in interest rates or exchange rates affect your profits? Excel
offers some easy-to-use tools to save time doing your calculations and
help you make more accurate forecasts.
This tutorial uses the simple example of a cash loan to demonstrate some of these tools. It makes use of
Excel's PMT Function to calculate repayments on a loan, then shows how you can use the Goal Seek tool to
manipulate variables such as the amount borrowed, repayment period and
interest rate to arrive at a desired result. You will see how to use Data Tables to display a large number of
calculations employing one or two variables and finally use Conditional Formatting to present the results in
an easily understandable way.
The screenshots in this document were taken in Excel 2010 and apply equally to Excel 2007. Most features
also apply to Excel 2003.
The PMT function is used to calculate the repayments on a loan based on a constant interest rate.
It can accept up to five arguments. The first three are required and often only these are used:
Rate - The interest rate expressed as a percentage (you use the percent sign when entering the rate into the
cell). When entering this argument you need to take account of the frequency of the payments. For example,
if the payments are monthly this value should be divided by 12 when
entered into the function.
Nper - The total number of payments for the loan. For example, for a loan repaid monthly over a period of 3
years this value would be 36 (i.e. 36 months).
Pv - The present value. This represents what the total value of the loan is worth now (i.e. how
much is to be borrowed). Enter this as a minus value so that the function returns a positive value for the
repayments.
Fv - The future value. Enter a value here if you want to end the loan period with a cash balance
(i.e. it is not being paid off completely to zero). Omit this value if the entire amount borrowed is to be repaid.
Type - Usually repayments are made at the end of each period, in which case this argument is omitted. Enter
1 if the repayment is made at the beginning of the period.
216
Computer literacy Program… Data Analysis using MS Excel
The Goal Seek tool allows you to determine what value a particular argument needs to hold so that that a
function will return a specified value. In this example the PMT function has calculated that a loan of £20,000
over 60 months at an interest rate of 6.8% per annum will require a monthly
repayment of £394.14. Using the Goal Seek tool you can find out, for example, how much money you could
borrow if the repayments were only £350 per month. Essentially, you tell Excel what you want the answer to
be and which value it can change to achieve that.
1. Open the Goal Seek tool by going to the Data tab then choosing What-If Analysis and
Goal Seek.
2. In the Goal Seek dialog box specify which cell will display the desired value. To do this click
in the Set cell: textbox then click on the cell that displays the result of your calculation.
This cell must contain a calculation (a formula or function).
3. Type the value that you want the calculation to return in the To value: textbox.
4. Specify which cell contains a value that Excel can change in order to arrive at the desired
result. Do this by clicking in the By changing cell: textbox then clicking on the cell that
contains the value that you are allowing Excel to change. This cell must be one of the
values used, directly or indirectly, in the calculation.
When you click OK Excel calculates the required value and opens a new dialog box to display the
result. It also inserts a new value into the specified cell so that the calculation now displays the
required result (Fig.2).
217
Computer literacy Program… Data Analysis using MS Excel
The Goal Seek tool is very useful and saves a lot of ―trial and error‖ when trying to forecast the
result of changes to your calculations, but it is limited to changing only one variable at a time. To see the
result of a changing input over a range of values would require you to run Goal Seek many times and record
the input values and results for each. (Excel’s Solver Add-In can be used for
working with more than one variable but is a very much more complex tool to use.) Fortunately, Excel has
another tool to help simplify that job, the Data Table.
Data Tables
Excel's Data Table tool provides a quick and easy way to perform "what if" analysis. It is used to create a
range of cells called the data table. The values displayed in the data table represent the result of changing
certain input variables in your calculation. You can specify what those changing variables are and the range
of input values that is used to create the table. Calculations can contain many input variables. The data table
tool can be used to represent changes in one or two of them. As with the Goal Seek example, this example
also uses the PMT function to demonstrate data tables. Although this is a simple example remember that
data tables can be used with any calculation that has a variable input.
You might want to vary any of the values used by the PMT function. The length of the repayment period can
be changed to suit your budget. Perhaps you want to compare the interest rates of different lenders. Or
maybe you would consider changing the amount of the loan so that you could determine the optimum term
and monthly payment. To examine the effect of changing one of these variables use a Single Variable Data
Table. To compare the effect of changing two of the variables use a Two Variable Data Table.
First create your initial function. If you wish to locate your data table elsewhere on the worksheet simply
place a copy of the original function where you want it to start. In this example the function is situated in cell
C7. You should position the function on the worksheet so that there is space in the column below it and
218
Computer literacy Program… Data Analysis using MS Excel
also to the left. Suppose you want to see the effect of different loan amounts (e.g. from £15,000 to £30,000).
Enter the list of values in the column that is to the left of the initial function, and starting in the row below it
(in this example cell A8) remembering to express the values in the same way as in the initial function.
Now select the block of data that contains the original function and the column of values you just
entered, on the Data tab of the ribbon choose What-If Analysis then Data Table to open the
Data Table tool. Click in the textbox marked Column input cell then click on the cell in that
supplied the value in the initial function that corresponds to the column of values you entered
(Fig.3). In this example it is cell B1 (the Loan Amount). Finally, click OK to dismiss the dialog and
create the table (Fig.4). Here the result cells have been formatted to show only two decimal places.
219
Computer literacy Program… Data Analysis using MS Excel
table tool. In this example the Row input cell is the one containing the Term in the initial function (cell B3)
(Fig.5). The Column input cell, representing the Loan Amount, is the same as before (cell B1).
Conditional Formatting
The mass of figures in a large data table can make it difficult to read but this can be made a lot easier with
the aid of Conditional Formatting. Unlike regular formatting, conditional formatting can change the
appearance of a cell according to the value displayed in it. Consider the example of a two-variable table
shown in the section on Data Tables. Suppose your criteria for a loan were that the monthly repayment was
220
Computer literacy Program… Data Analysis using MS Excel
between £300 and £350. There are numerous cells in the table whose values fall in that range but it is
difficult to find them, and the table will change if any of the other variables in the calculation are changed.
It’s an ideal candidate for conditional formatting. In this example (Fig.7) three different conditional formats
have been applied to the data table. Cells displaying values greater than £350 are shown in red (these are
beyond the upper end of my price range - I can’t afford them); cells displaying values less that £300 are
shown in yellow (these are below the lower end of my price range - I can afford a higher payment); and cells
whose values fall between £300 and £350 are shown in green (these are the ones I am interested in).
2. Go to the Data tab and click the Conditional Formatting button then choose Highlight
Cells Rules then Greater Than…
3. In the Greater Than dialog box enter a value above which the cells should display a certain
format, in this example 350. Notice that as you do so Excel displays a preview of the
chosen format on your data (Fig.8).
4. Choose a preset format from the drop-down list (in this example Light Red Fill with Dark
Red Text was chosen) or choose Custom Format and devise your own format.
5. Click OK to apply the first format rule and close the dialog box. Leave the cells selected.
6. Repeat the procedure on the same range of cells, this time choose Conditional
221
Computer literacy Program… Data Analysis using MS Excel
Formatting > Highlight Cells Rules > Less Than… and in the Less Than dialog box enter 300 and choose
Yellow Fill with Dark Yellow Text.
7. Click OK to apply the second format rule and close the dialog box. Leave the cells selected.
8. Repeat the procedure on the same range of cells and choose Conditional Formatting >
Highlight Cells Rules > Between… and in the Between dialog box enter 300 and 350
and choose Green Fill with Dark Green Text.
9. Finally, click OK to apply the third format rule and close the dialog box.
10. When you deselect the cells you should now have a formatted range of cells looking
something like that shown here (Fig.7).
You don’t have to apply several different formats. You may just want to highlight cells that satisfy a
particular condition.
When applying multiple conditional formats you are not limited to just three conditions as in this example.
You can add as many as you need but remember to apply all your formats to the same range of cells. Make
sure that your format rules do not conflict. For example, if you choose Greater than 100 as one rule and
Greater Than 200 as another rule, which of the rules should apply to a cell showing a value of 250 since both
rules apply? (You can in fact specify a rule for this dilemma using the Manage Rules tool but if you are new
to conditional formatting it is best to avoid conflicts in the first place!)
In addition to using regular formatting tools such as cell fill colours and font colours as in the previous
example, Excel offers a range of Icon Sets, Data Bars and Colour Scales to denote specified cell values. You
can apply these directly to your data but it is more likely that you will want to specify your own particular
conditions. Excel allows you to do this using the Manage Rules tool.
Using the previous example, you might choose to apply the Traffic Light icon set instead of fill and font
formatting. To do this first apply your chosen icon set by going to Conditional Formatting > Icon Sets and
choose an icon set from the list, in this case the three-colour traffic light set. Excel applies the icon set to the
data but at the same time applies its own rule for which value range each colour represents (Fig.9).
222
Computer literacy Program… Data Analysis using MS Excel
NOTE: When you apply an icon set you might find that your cell values are replaced by hash marks
(#####). This simply means that in order to make room for the icon the number cannot be properly
displayed. Simply widen each column to allow the values to be shown.
To specify your own rules go to Conditional Formatting > Manage Rules. In the Conditional Formatting
Rules Manager select your chosen rule and click Edit Rule
Because there are three icon colours in this set Excel has created its own rule dividing the range of values
into three by percent (>=67% green, <67% and >=33% yellow, <33% red) but I want the colours to apply to
specific numerical ranges and in a different order with red representing the
highest values.
In the Edit Formatting Rule dialog I could simply click the Reverse Icon Order button but this
would make the middle range yellow and I want that one to be green, the same as I had in the
previous example. Fortunately Excel lets me specify which icon applies to each range. Making sure that
Format all cells based on their values is selected, all I have to do is select the appropriate icon from the Icon
223
Computer literacy Program… Data Analysis using MS Excel
dropdown, choose my operator (>= or >) and enter a value in the Value box and choose Number from the
Type dropdown (Fig.10).
224
Computer literacy Program… Data Analysis using MS Excel
After clicking OK to dismiss the dialogs and apply the modified rule the data appears with the same colours
as before but using traffic light icons instead of fill and font colours (Fig.11).
Excel 2007
Creating Pivot Tables
Introduction
PivotTable reports, or PivotTables as they are often called, can help you answer questions about your
spreadsheet by analyzing the numerical information in various ways. If you work with spreadsheets with a
lot of data, a PivotTable can be an extremely useful tool. PivotTable reports give you power because you
can quickly find the answer to many different questions and can manipulate your data in many different
ways.
In this lesson, you will learn the basics of inserting and working with PivotTable reports.
PivotTable reports
You may be wondering why it is called a PivotTable. Basically, PivotTables allow you to pivot, or move,
data so you can produce answers to questions. Once you create a PivotTable, you can very easily see
what effect pivoting the data has on the spreadsheet information.
Select the cells in your spreadsheet that you want to use in the PivotTable report.
225
Computer literacy Program… Data Analysis using MS Excel
Click PivotTable again. Excel selects cells in the actual spreadsheet, and the Create PivotTable dialog
box opens.
Select a table or range is already selected, and the Table/Range field shows the range of the selected
data. New Worksheet is also selected by default as the place where the report will be placed.
Click Existing Worksheet, then select a worksheet if you do not want the PivotTable to appear in a new
worksheet.
Click OK.
If you use the sample spreadsheet to create a PivotTable, you can see that the column headings are
salesperson, region, account, order amount, and month. When you create a PivotTable, each column
label in your data becomes a field that can be used in the report. The Field List appears on the right side
of the report, while the layout area appears on the left.
226
Computer literacy Program… Data Analysis using MS Excel
Determine what question you want your PivotTable report to answer. For example, using the sample
spreadsheet, you might want to know which salesperson sold the highest dollar amount.
Determine the fields that are necessary to answer this question—in this example, salesperson and order
amount.
Select the check box next to the Salesperson field in the PivotTable Field List. The field will appear in
the drag-and-drop area at the bottom of the field list and in the layout area. The order amount data appears
on the right. This is a default setting in Excel—data with numbers will always appear on the right.
Select the check box next to the Order Amount field in the PivotTable Field List. The field will appear
in the drag-and-drop area at the bottom of the field list and in the layout area. All of the salesperson data
appears on the left side as rows.
You can now see the answer to your question in the report on the left.
227
Computer literacy Program… Data Analysis using MS Excel
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 Options Refresh.
Select a field in the Field List. In this example, choose Region. By default, it will appear in the Row
Labels group.
Release the mouse button. The region appears at the top of the report as a filter.
The arrow by the Region fields shows (All). To show just the data for a specific region, click the drop-
down arrow, and select the region. To see multiple regions, click the Multiple Regions box, select the
regions to display, then click OK.
228
Computer literacy Program… Data Analysis using MS Excel
Release the mouse button to drop the field in the new area. In this example, we move Region from
Report Filter to Column Label. The PivotTable report will change.
OR
229
Computer literacy Program… Data Analysis using MS Excel
To create a PivotChart
Select the PivotChart command from the Options tab. The Insert Chart dialog box appears.
Click OK. The chart will now appear on the same sheet as the PivotTable.
230
Computer literacy Program… Data Analysis using MS Excel
As September approaches, I can count on a series of spreadsheet questions. One of the popular Excel
tutorial requests is how do you look up a value on one Excel worksheet and use it on another Excel
worksheet. For example, you need to translate a product number into a product name. One of my
favorite Excel functions is the VLOOKUP function and it can help with this task. (Includes Excel VLOOKUP
Example file and video in reference section.)
A recent case involved some voter registration data I needed to analyze. On one Excel spreadsheet, the
voter’s party was listed as an alphanumeric value called "Pcode" and not the political party. This coding
wasn't intuitive. For example, “D” was for “American Independent Party”, but some thought it meant
“Democratic Party”.
One way to solve this problem is to create a worksheet with the Pcode and translation and have Excel
use the VLOOKUP function for the party name. You might think of VLOOKUP as an Excel translator. I
could then add a column called “Political Party” to my original worksheet to show the information from a
lookup table.
A lookup table includes the values you wish to "lookup" such as our Pcode and the translation such as
political party. You can place this table on the same worksheet, but for this Excel tutorial I'll add a
worksheet called "Political Party".
2. On the Insert dialog, double-click Worksheet. This will be on the General tab.
3. Rename this new worksheet tab with a descriptive name such as “Party Codes”
4. In Column A, enter the unique values that exist on your main worksheet. In my example, these were
the codes that showed in the Pcode column in the thumbnail. These values should be in ascending
order.
231
Computer literacy Program… Data Analysis using MS Excel
5. In Column B, enter the translated value. You can have more values in column A than appear on your
main spreadsheet. For example, I have an entry for “Citizen Party” even though I didn’t show a
registered voter with that affiliation.
Excel’s VLOOKUP function uses 4 pieces of information. The function panel may seem intimidating with
the terms, but it’s simpler than it looks. (Note: If you have Excel 2007 or 2010, you can find an additional
PDF file with updated screen prints in the resources section at the bottom.)
1. Add your new column on your original worksheet that will display the info pulled from the Lookup
table. In my example, I added a column called Political Party in Column D. This is where I will insert the
Excel function.
2. Place your cursor in the first blank cell in that column. In my example, this is cell D2.
3. From the Insert menu, select Function…. The Insert Function dialog will appear.
232
Computer literacy Program… Data Analysis using MS Excel
4. In the Search for a function: text box, type “vlookup” and click Go.
After you click OK, Excel’s Function Arguments dialog appears and allows you to define the four values.
You’ll see that your starting cell and the formula bar show the beginning part of the function
=VLOOKUP(). The Function Arguments dialog adds the needed data elements that will display between
().
For illustration purposes, I have overlaid the Party Codes worksheet on top to show the relationships.
233
Computer literacy Program… Data Analysis using MS Excel
1. Lookup_value – Think of this field as your starting point. In my example, I’ll click cell C2 so the value is
filled in the dialog. I'm requesting Excel take the value of C2, which displays as the Pcode of “A”, and find
the matching political party on my lookup table on the Party Codes worksheet.
2. Table_array – This is the range for your lookup table. The range can be on your existing worksheet or
another worksheet such as our “Party Codes”. When you click another tab and define the range, Excel
prepends that tab name to the range such as ‘Party Codes’.
Rule 1 - The left column must contain the values being referenced. In other words, I couldn’t have our
first column be Political Party.
Rule 2 - You can’t have duplicate values in the leftmost column of the lookup range. I couldn’t have two
entries with the value “A” with one being “Democratic” party and another “A” for the “Humanist” party.
Excel would complain.
Rule 3 - When referencing a lookup table, you don’t want your cell references to change when you
drag and fill to populate the other cells with the VLOOKUP function. As example, if I want to use the
same function in cells D3 through D7, I don’t want my lookup cell references to shift each time I move
down to the next cell. I need the cell references to be the same. After you define your range, you need
to press F4 which will cycle through absolute and relative references. You want to select the option that
includes a $ before your Column and Row. ( 'Party Codes'!$A$2:$B$45. ) You can get around this if you
know how to use Excel name ranges.
Col_index_num – This is the number of the column on your lookup table that has the information you
need. In our example, we want column 2 from the Party Codes worksheet which has the name of the
political party.
Range-lookup – this field defines how close a match should exist between your Lookup_value (C2) and
the value in the leftmost column on our lookup table. In our case, we want an exact match so we’ll use
“FALSE”.
234
Computer literacy Program… Data Analysis using MS Excel
It doesn’t make sense to use VLOOKUP for one cell in your Excel spreadsheet. Instead, I want to copy the
function to other cells in the same column.
1. Click the cell containing the VLOOKUP arguments. In our example, this would be D2.
2. Grab the cell handle that displays in the lower right corner.
3. Left-click and drag down the cell handle to cover your column range.
Note: If I hadn’t changed to absolute reference as mentioned in Rule 3, I would’ve seen my table array
entry shift by one cell as we dragged down through the other cells.
VLOOKUP is a powerful Excel function that can leverage spreadsheet data from other sources. There are
many ways you can benefit from this function. In this example, I used a 1:1 code translation, but you
could also use it for group assignments. For example, you could assign state codes to a region such as CT,
VT, and MA to a region called “New England”.
COUNTIF function
Description
The COUNTIF function counts the number of cells within a range that meet a single criterion that you
specify. For example, you can count all the cells that start with a certain letter, or you can count all the
cells that contain a number that is larger or smaller than a number you specify. For example, suppose you
have a worksheet that contains a list of tasks in column A, and the first name of the person assigned to
each task in column B. You can use the COUNTIF function to count how many times a person's name
appears in column B and, in that way, determine how many tasks are assigned to that person. For
example:
=COUNTIF(B2:B25,"Nancy")
Syntax
COUNTIF(range, criteria)
range Required. One or more cells to count, including numbers or names, arrays, or references
that contain numbers. Blank and text values are ignored.
criteria Required. A number, expression, cell reference, or text string that defines which cells
will be counted. For example, criteria can be expressed as 32, ">32", B4, "apples", or "32".
235
Computer literacy Program… Data Analysis using MS Excel
Notes
You can use the wildcard characters — the question mark (?) and the asterisk (*) — in criteria. A
question mark matches any single character, and an asterisk matches any sequence of characters.
If you want to find an actual question mark or asterisk, type a tilde (~) before the character.
Criteria are case insensitive; for example, the string "apples" and the string "APPLES" will match
the same cells.
1 Data Data
2 apples 32
3 oranges 54
4 peaches 75
5 apples 86
236
Computer literacy Program… Data Analysis using MS Excel
237
Computer literacy Program… Data Analysis using MS Excel
M.C.Q.
3. = Today () = ___________________
(i) Day, (ii) Hours, (iii) Date
4. The view tab has sections which include workbook views, show
hide zoom
(i) 4 (ii) 3 (iii) 5
238
Computer literacy Program… Data Analysis using MS Excel
2. Section has option for pivot table and charts & tables.
1) Table 2) Charts 3) Table & Charts
Short questions:
239