0% found this document useful (0 votes)
78 views

20 Spreadsheets

The document discusses data modeling in spreadsheets. It describes how to create, format and analyze spreadsheet models using functions and formulas in Excel. Key topics covered include creating and manipulating rows and columns, using absolute and relative cell references, naming cells, common mathematical and statistical functions like SUM, AVERAGE, IF and VLOOKUP.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views

20 Spreadsheets

The document discusses data modeling in spreadsheets. It describes how to create, format and analyze spreadsheet models using functions and formulas in Excel. Key topics covered include creating and manipulating rows and columns, using absolute and relative cell references, naming cells, common mathematical and statistical functions like SUM, AVERAGE, IF and VLOOKUP.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

20.1 What is a Data Model?

A spreadsheet model, also known as “what if” scenario or “what if” modelling, is used for data
analysis purposes. They can be financial, mathematical or scientific models.

A spreadsheet consists of rows and


columns of cells. A cell is an entity shaped
like a box. It can hold a mathematical
formula, a number or text. It is referred to
by its column and row.

Each column is named after alphabets. The


first column is A, the next is B, and so on.
Each row is named after numbers – the
first row is 1, and the next is 2.

Rows and columns can be added to a spreadsheet. Rows are added on top of existing ones, and
columns are added to the left. Cells can be added as well, by shifting existing data to the left or
up.

To add rows:
1. Select the row headers of the number of rows you want to add.
2. Right-click on the selected row to open the context menu.
3. Choose Insert.

To delete rows:
1. Select the row headers of the rows to be deleted.
2. Right-click on the selected row to open the context menu.
3. Choose Delete.

To add columns:
1. Select the column headers of the number of columns you want to add.
2. Right-click on the selected row to open the context menu.
3. Choose Insert.

To delete columns:
1. Select the column headers of the columns to be deleted.
2. Right-click on the selected row to open the context menu.
3. Choose Delete.

20.2 Create a Data Model

Cells can be selected by just clicking on them. To select more than one cell, hold down the Shift
key.

Excel 2010 also supports Autofill. This allows cells to be automatically filled up, following an
established pattern.

To use Autofill:
1. Fill up at least two cells
with data in a
recognizable pattern.
2. Select the cells.
3. Select the dot on the
lower right corner of the
cells.
4. Drag down or to the right
to autofill the cells.

Cell references in formulae can be absolute or


relative.

A relative reference is the default setting in Excel.


Relative cell references change when they are
copied and pasted to other cells.

An absolute reference is distinguished by $ symbols


before the column and row references. They do not
change when the formula is copied and pasted to
other cells.
The table below explains absolute reference in greater detail:
Format Meaning Explanation
$A$1 Row and column locked Cell reference will not change at all as cell is copied and
pasted.
$A1 Column locked Only row reference will change as cell is copied and
pasted.
A$1 Row locked Only column reference will change as cell is copied and
pasted.
A1 Nothing locked Both row and column references will change as cell is
copied and pasted.

Instead of using absolute and relative references, users can also opt to name cells and ranges. A
named range is just a
range of cells in Excel
with a label. To name a
cell or a range of cells,
just select the cell or
range of cells, type a
name in the name box
and press Enter.

There are certain rules that the names must follow:


 Names must begin with a letter, an underscore or a backslash.
 Names can’t contain spaces or punctuation characters.
 Names can’t conflict with cell references.
 Single letters can be used, but “r” and “c” are reserved.
 Names are not case sensitive.

Data should be entered as accurately as possible into a spreadsheet, to get the required results.
To ensure that intermediate results are accurate, formulae can be used.

Formulae can be entered into Excel easily, by typing in an = symbol. Some of the common
operators used in formulae are:
 Addition – use =B1+B2 to add up the contents of B1 and B2.
 Subtraction – use =B1-B2 to find the difference between B1 and B2.
 Multiplication – use =B1*B2 to find the product of B1 and B2.
 Division – use =B1/B2 to find the results of B1 divided by B2.
 Indices – use =B1^B2 to represent B1 to the power of B2.

The above formulae would work with numerical values as well as cell references.
When using copy and paste functions in Excel, formulae will be copied and pasted over if the
original cell contains them. If not, the value in the cell would be copied and pasted to the new
cell.

Formulae can be displayed directly in the cells, instead of results. This can be useful sometimes,
when working with complicated formulae. To show the formula in cells:
1. Go to File > Options > Advanced > Display Options for this Worksheet.
2. Select Show Formulas in Cells instead of Calculated Results.
3. Print the worksheet from here if you’d like to print out the formulae instead of the
results.
4. To revert between show formulae and normal view, the shortcut key Ctrl + ` can also be
used.
As opposed to formulae, functions are predefined formulae that are already included in Excel.
Every function uses the same structure – the “=” sign, followed by the name of the function, and
arguments between brackets. Functions increase user productivity when working with Excel.

Users may not remember all the functions available in Excel. To help with this, users can:
1. Select the cell where the function should appear.
2. Click the Insert Function button.
3. Search for the required function and click OK.
4. Fill in the range and criteria required, and click OK.

Some of the common functions are described below:


Function Description Usage
SUM Adds all values in a range of cells. =SUM(E4:E8)
AVERAGE Calculates the average value in a range of cells. =AVERAGE(E4:E8)
MAX Finds the maximum value in a range of cells. =MAX(E4:E8)
MIN Finds the minimum value in a range of cells. =MIN(E4:E8)
INT Rounds a number down to the nearest integer. =INT(E4)
TRUNC Truncates the number to just the integer portion =TRUNC(E4)
by removing any decimal portion.
ROUND Takes an amount that has many decimals and =ROUND(E4, 2)
round it to the number of decimals that you
want.
ROUNDUP Always rounds up to the next higher number, =ROUNDUP(E4, 0)
away from zero.
ROUNDDOWN Always rounds down to the previous lower =ROUNDDOWN(E4, 1)
number, towards zero.
COUNT Counts the number of cells in a range of cells. =COUNT(E4:E8)
COUNTA Counts the cells that contain numbers, text, =COUNTA(E4:E8)
logical values, error values, and empty text ("").
COUNTIF Counts the fields that match a certain criterion, =COUNTIF(E4:E8, ">=1000")
instead of summing them.
IF Performs a logical test and return one value for a =IF(E4=1, “YES”, “NO”)
TRUE result, and another for a FALSE result.
SUMIF Adds all the values in a range of cells that meet a =SUMIF(E4:E8, ">=1000")
specified criteria.
ABS Changes negative numbers to positive, and =ABS(E4)
leaves positive numbers alone.

The order of operator precedence in the formulae and functions is as follows:


1. Any part of the formula in parentheses.
2. Multiplication and division.
3. Addition and subtraction.

The LOOKUP function allows a user to search for a piece of data in a row or column and return a
corresponding piece of data in another row or column. There are three variations of the function
– LOOKUP, VLOOKUP and HLOOKUP.

VLOOKUP is the oldest lookup function. It allows a user to search for information vertically, and
returns data from left the right.

For example, VLOOKUP can be


used to search for the student
name and semester grade,
based on a user-supplied
Student ID Number.
The format of the
VLOOKUP function
is
=VLOOKUP(lookup_
value, table_array,
col_index_num,
range_lookup).
These are explained
in detail below:
 The lookup_value is the cell of the user input. In the example above, this is the cell
where the user typed in 1234.
 The table_array is the area of the cells in which the table is located. In the example
above, this would refer to the cells in the table where 1234 is located, all the way to the
B grade for Rod Ameson.
 The col_index_num refers to the column of data that includes the answer required. This
would be 2 and 3 in the example, as the Student Name is in column 2, and Semester
Grade is in column 3.
 Range_lookup is TRUE (gives the closest match) or FALSE (gives the exact match).

HLOOKUP allows a user to search for information horizontally in rows.


LOOKUP is more flexible, as:
 Users can search for information both vertically and horizontally.
 Allows left-to-right and right-to-left procedures.
 Can replace both VLOOKUP and HLOOKUP.

The XLOOKUP function is used to find things in a table or range by row. It can be used to replace
both VLOOKUP and HLOOKUP. It allows users to search to the left or right, and to the top or
bottom. It searches a range or an array, and then returns the item corresponding to the first
match it finds. If no match exists, then XLOOKUP can return the closest match. The basic syntax
for XLOOKUP is =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found],
[match_mode], [search_mode]).
In the above example, the following formula would be used: =XLOOKUP(A2, $E$2:$E$8,
$F$2:$F$8). Notice that the column index number has been eliminated. Also, XLOOKUP can view
the data left of the selected cell, as a return array is indicated, instead of the column index
number.

A custom value can be defined if no results are found. This can be done using the not_found
argument. If this is not defined, #N/A will appear by default.

The match_mode argument would allow the user to select the type of matches allowed in the
search. By default, the value is set to 0 for exact match. The user can also select -1 for exact
matches or the next value below, 1 for exact match or the next value above, or 2 for wildcard
matches.
Wildcard Character Description Example
? Matches any single character Gr?y finds “grey” and
“gray”
* Matches any sequence of characters Mid* finds “Midwest” and
“Mideast”
~ followed by *, ? Allows filtering cells that contain a What~? finds “What?”
or ~ real ?, * or ~

Lastly, the search_mode argument allows the user to determine the search order. A value of 1
will return the first value found, whilst a value of -1 will reverse the search order and return the
last matching value.

The IF function evaluates a condition and returns one value if it’s true, and another if it’s false.
The syntax for the function is =IF(logical test, [value_if_true], [value_if_false]).

IF function is best suited for situations where a condition must


be tested and different values returned based on the outcome
of the test.

The following example checks if a student has passed or failed


an examination. The function used for column B is =IF(A2>=35,
“Pass”, “Fail”).

IF functions can also be nested to check a sequence of conditions.


The example on the right shows that the spreadsheet above can
be improved by adding different tiers of grades.

The function has been improved by using =IF(A2<35, “Fail”,


IF(A2>=75, “Distinction”, “Pass”)).

20.3 Testing a Data Model

To set up a simple calculator in Excel, do the following:


1. Open a new spreadsheet, and delete Sheets 2 and 3.
2. Rename Sheet 1 Calculator.
3. In A1, type First Number – X.
4. In A2, type Second Number – Y.
5. In A4, type Sum of X and Y.
6. In B4, =B1+B2.
7. In A5, type Difference between X and Y.
8. In B5, type =ABS(B1-B2).
9. In A6, type Product of X and Y.
10. In B6, type =B1*B2.
11. In A7, type X divided by Y.
12. In B7, type =B1/B2.
13. In A8, type X to the power of Y.
14. And in B8, type =B1^B2.
15. Key in different numbers to B1 and B2, and watch the data in column B change
accordingly.
16. Save the file as Calculator.xls.

A test plan is created to record various tests performed on a spreadsheet model and their results.
Test the calculator using the following test plan:
Data Data Data Expected Results Actual Results
Entry in Entry in Type
B1 B2
1 2 Normal B4=2
B5=1
B6=2
B7=0.5
B8=1
8 4 Normal B4=12
B5=4
B6=32
B7=2
B8=4096
0 5 Normal B4=5
B5=5
B6=0
B7=0
B8=0
3 0 Normal / B4=3
Abnormal B5=3
B6=0
B7=Error, value undefined
B8=1

20.4 Manipulate Data

Data can be searched through easily in Excel.


The easiest way to look at selected data only is to use filters. These are used to narrow down
data in the spreadsheet and hide irrelevant data from view. Data can be filtered only if there is a
header row in the spreadsheet.

To filter data:
1. Select any cell.
2. Go to Data > Sort & Filter > Filter.
3. Drop-down arrows will appear on the column headings. Click on the column heading you
want, and check the boxes of the data required.
4. Uncheck the Blank option if you do not wish to see blank cells.
5. Repeat if there are multiple columns you want to filter with.

Text filters have the following options:


 Equals
 Does Not Equal
 Begins With...
 Ends With...
 Contains...
 Does Not Contain...
 Custom filter...

Number filters have the following options:


 Equals
 Does Not Equal
 Greater Than...
 Greater Than Or Equal To...
 Less Than...
 Less Than Or Equal To...
 Between...
 Top 10...
 Above Average...
 Below Average...
 Custom filter...

Date filters have the following options:


 Equals
 Before...
 After...
 Between...
 Tomorrow
 Today
 Yesterday
 Next Week
 This Week
 Last Week
 Next Month
 This Month
 Last Month
 Next Quarter
 This Quarter
 Last Quarter
 Next Year
 This Year
 Last Year
 Year To Date
 All Dates in the Period
 Custom filter...

Custom filter allows a combination of two filters, using AND or OR options.

Color filters have the following options:


 Filter by Cell Color
 Filter by Font Color
 Filter by Cell Icon

Users can also sort data to increase productivity and spreadsheet readability. Data can be sorted:
 Alphabetically.
 Numerically.
 Chronologically.

To sort data:
1. Select a cell in a column you want sorted.
2. Go to Data > Sort & Filter > Sort.
3. Select a suitable sort.
4. Add Level if you would like to add another column to the sort.
5. Click on Options to add in additional features to the sort.
6. Click OK.

20.5 Present Data

How the data is displayed would affect the presentation of the data in the spreadsheet. There
are various options that can be used in Excel to enhance the attractiveness of the data.

Right-clicking on any cell will bring up a menu of selections, including the Format Cells dialog box.
This box is very useful in making changes to how the spreadsheet looks.

The numbers in any cell can be formatted according to taste. There are options to increase or
decrease decimal places, add in currency symbols, convert numbers to dates and times, add in
fractions and percentages, and convert data into scientific notations. These can be completed
through the Format Cells > Numbers selection.

The background of a cell can be filled with a color or a pattern,


including special fill effects like gradients:
1. Select the cells required.
2. Go to Home > Font > Fill.
3. Choose a fill color or a pattern.
4. Right-click on the cells and select Format Cells >
Fill > Fill Effects.
5. Make the required changes and click OK.

Fonts can be selected through the Home > Font tab., just as in other Microsoft Office
applications. In addition to that font colors can also be changed.

Also, users can opt to add borders to cells. Select the cells required, right-click and select Format
Cells > Borders. Click on the borders you want.

Text can be aligned in Excel, just as in Microsoft


Word, Access and PowerPoint. Go to Home >
Alignment > Format Cells. The options available
are:
 Horizontal alignment (left, right,
center and justified).
 Vertical alignment (top,
middle and bottom).
 Merging cells.
 Wrap text.
 Shrink to fit.
 Text orientation.

The format painter here works the same


way as in Microsoft Word. In addition to
that, Excel also offers conditional
formatting, which allows data that
fulfils certain criteria to be highlighted.

For example, a user can opt to highlight only the odd


numbers in a data range, by using the ISODD function.

To use conditional formatting:


1. Select the cells you want to format.
2. Right-click and select Conditional Formatting.
3. Select the rule type.
4. Type in the formula to be used.
5. Click on the Format button and make the
necessary changes.
6. The Preview text box will change accordingly.
7. Click OK.

By default, Excel sets row height to 15 and column


width to 8.38. To change these:
1. Right-click on a row or a column.
2. Select Row Height or Column Width
accordingly.
3. Type in the required value in the text box.
4. Click OK.
5. Go to Home > Cells > Format.
6. Select Autofit Row Height or Autofit Column Width to make the row height or column
width change automatically to fit the longest text in the selection.

Cells can also be protected from the same menu. There are options to protect the sheet, or to
lock the cell. A password can be set to ensure that only authorized users can access or make
changes.
Page orientation and page setup can be changed by selecting Page Layout on the Ribbon. There
are choices for margins, orientation, size, print area, background and breaks. The terms used
here are all the same as those in Microsoft Word. The only difference is the background option,
which allows the user to select a sheet background for the worksheet.

In Excel, part or all of a worksheet can be printed separately, or the user can opt to print the
whole spreadsheet. Printing is also quite easily done:
1. Set up the print area, using the blue boundary lines.
2. Select the row or column where you want to insert page breaks at.
3. Go to Page Layout > Scale to Fit to fit everything into one page.
4. Ensure both Wide and Tall settings are at 1, and click OK.

20.6 References

Ablebits, How to Show Formulas in Excel, Accessed 11 June 2018

CareerFoundry, How to Use the XLOOKUP Function in Excel, Accessed 13 October 2021

Corporate Finance Institute, Basic Excel Formulas Guide, Accessed 11 June 2018

Deskbright, Absolute and Relative Cell References, Accessed 11 June 2018

Excel Easy, Formulas and Functions, Accessed 18 June 2018

ExcelJet, 20 Tips for Named Ranges in Excel, Accessed 18 June 2018

GCF LearnFree, Excel 2010: Filtering Data, Accessed 21 June 2018

Guru99, Best Excel Formulas & Functions: You Need to Know Now, Accessed 19 June 2018

How-To Geek, How to Set Row Height and Column Width in Excel, Accessed 21 June 2018

Keynote Support, Formatting Cells in Microsoft Excel, Accessed 21 June 2018

Lifewire, How to Add or Delete Rows and Columns in Excel, Accessed 8 June 2018

MBAExcel, Tutorial: How to Decide which Excel Lookup Formula to Use, Accessed 19 June 2018
Microsoft Ignite, Int, Round, RoundDown, RoundUp, and Trunc Functions in Power Apps,
Accessed 13 October 2021

Microsoft Support, Sort Data in a Range or Table, Accessed 21 June 2018

Saint Martin’s University, Basic Spreadsheet Modelling Concepts, Accessed 7 June 2018

TechOnTheNet, MS Excel 2010: Protect a Cell, Accessed 21 June 2018

TechRepublic, Five Tips for Printing Excel Data More Efficiently, Accessed 21 June 2018

The University of Utah, Spreadsheet Basic, Accessed 7 June 2018

Trump Excel, Excel IF Function – Introduction, Accessed 30 June 2018

University of Michigan Library, Using Autofill, Accessed 8 June 2018

You might also like