Excel Formulas Review
Excel Formulas Review
EXCEL REVIEW
2007
Contents
Page
I. Formula Basics
The Building Blocks: Values, Cell References, & Operators..................................... 1
Excels Order of Calculations........................................................................................ 4
Controlling Calculation in Workbooks ....................................................................... 5
Entering & Editing Formulas........................................................................................ 7
Formula-Building Recommendations ......................................................................... 10
Calculating With Date & Time Values ........................................................................ 11
Replacing a Formula With a Value .............................................................................. 12
Naming Cells & Ranges Used in Formulas ................................................................ 13
Using a Formula to Name a Range .............................................................................. 16
Understanding Relative, Absolute, and Mixed Addressing .................................... 19
How to Display Formulas in a Worksheet.................................................................. 22
Array Formulas............................................................................................................... 23
Precision in Calculations ............................................................................................... 25
Edit, Fill, Series................................................................................................................ 26
Quick Calculations With the Status Bar ...................................................................... 27
Finding Formulas ........................................................................................................... 28
Writing and Using Formulas With Links.................................................................... 29
Auditing Your Formulas ............................................................................................... 31
I. Formula Basics
The Building Blocks: Values, Cell References, & Operators
The building blocks of Excel formulas are values, cell references, and operators.
A value can take the form of a number (20, 100, .015), text (The Fuqua School of
Business, Duke basketball), or a date (4/1/01, April 1, 2001).
A cell reference identifies a single cell or a range of cells on a worksheet and tells
Excel where to look for the values or data you want to use in a formula. With
references, you can use data contained in different parts of a worksheet in a
single formula or use the value from one cell in several formulas. You can also
refer to cells on other sheets in the same workbook, to other workbooks, and to
data in other programs. References to cells in other workbooks are called external
references. References to data in other programs are called remote references.
Excel has two cell reference styles: The A1 style and the R1C1 reference style. By
default, Excel uses the A1 reference style. This style refers to columns with letters
(A through IV, for a total of 256 columns) and to rows with numbers (1 through
65,536). These letters and numbers are called row and column headings. To refer
to a cell, enter the column letter followed by the row number. For example, D50
refers to the cell at the intersection of column D and row 50. To refer to a range of
cells, enter the reference for the cell in the upper-left corner of the range, a colon
(, and then the reference to the cell in the lower-right corner of the range.
Examples of A1-style references:
To refer to
The range of cells in Column A and rows 10-20
The range of cells in Columns A-E and rows 1-20
Use
A10:A20
A1:E20
5:5
5:10
A:A
B:H
With the R1C1 reference style, both the rows and the columns on a worksheet are
numbered. The R1C1 style is particularly useful for computing row and column
positions in macros. In the R1C1 style, Excel indicates the location of a cell with
an R followed by a row number and a C followed by a column number.
Toggle on or off the R1C1 reference style by choosing Tools, Options and selecting
the General tab.
Operator
Description
: (colon)
Reference operator
(single space)
, (comma)
-
Percent
Exponentiation
* and /
+ and
&
Concatenation
Comparison
If you select an option other than Automatic, press F9 (or the Calc Now (F9)
key) to make Excel perform calculations in all worksheets in all open workbooks.
To calculate only the active worksheet, press SHIFT+F9 (or the Calc Sheet
button).
Excel calculates stored, not displayed, values. The displayed (and printed) value
depends on how you choose to format and display the stored value. For
example, a cell that displays a date as 6/22/96 also contains a serial number that is
the stored value for the date in the cell. You can change the display of the date to
another format (for example, to 22-Jun-96), but changing the display of a value
on a worksheet doesnt change the stored value.
The formula bar displays at the top of the Excel workspace below Excels menu
bars and any open toolbars. The formula bar includes a Name Box/function
list at left, an X mark to cancel a formula, a check mark to enter a formula, and an
equals sign to begin a formula. The formula itself displays at right in the formula
bar. The result of the formula you typed appears in the spreadsheet cell.
Youll almost always use cell references in the formulas you build. You need not
enter cell references into a formula by typing them, however. Instead, once your
formula is started (once youve typed an equals sign), you can click a cell whose
reference you want included in the formula. Using this technique can spare you
entering mistaken references.
For example, to use this technique to enter the formula = SUM(B1,C25)*F3,
follow this sequence:
=SUM(
Cell B1
,
Cell C25
)*
Cell F3
the enter key
Type
Click
Type
Click
Type
Click
Click
Excel makes available a feature called the Formula Palette. The palette displays
when you click the equals button on the formula bar to create (or edit) a formula.
The palette has two display modes: One, if youre entering a formula that
includes one of Excels built-in functions and the another if youre entering a
formula without a built-in function.
The formula palette that displays when no built-in functions are used in the
formula.
Both palette views show what the result of the formula will be. If youre
including a function, the palette shows the result of the function as well as the
result of the formula.
The sum function result is 150 but the formula result is 112.5. Both are displayed
in the formula palette. The values used in the function also display.
Formula-Building Recommendations
Formulas express relationships between values, both known and variable. Avoid
using numbers (actual data) in Excel formulas. Instead use cell references that
point to cells that hold the data. By keeping each data item in a unique location
in the worksheet you can much more easily change an item if necessary and have
the change be reflected wherever the item is used throughout the worksheet.
In the illustration below a tax rate value is stored in Cell B1. The calculations in
Column D all use that tax rate value. Instead of including the actual value of 5%
in the formulas, a reference to that cell is made. The formulas in Column D are:
=(B4+C4)*$B$1
=(B5+C5)*$B$1
=(B6+C6)*$B$1
Should the tax rate change from 5% to 6% only the value in the tax rate cell, B1,
must change. The formulas that use the tax rate refer to the cell, so they need not
be changed.
By contrast, if the formulas you build use actual values, youll spend much more
time finding and editing values should they change. For example:
Use This
=(B4+C4)*$B$1
Instead of This
=(45+23)*5%
=(B5+C5)*$B$1
=(28+42)*5%
=(B6+C6)*$B$1
=(66+85)*5%
10
Number
36991
0.1354
For a date calculation, either refer in the formula to cells that contain dates, or -to include actual dates in the formula surround them with double quotes. For
example, this formula:
=4/10/01 3/10/01
yields the value 31.
Excel supports two date systems: the 1900 and 1904 date systems. The default
date system for Excel is 1900. If you have a need to the 1904 date system, choose
Tools, Options, select the Calculation tab and toggle on the 1904 date system
check box. The table below shows the first date and the last date for each date
system and the serial value of each.
1900
January 1, 1900
(serial value 1)
1904
January 2, 1904
(serial value 1)
Use the DATE function to manipulate a part of a date within a formula. Use the
TIME function to manipulate a part of a time such as the hour or minute
within a formula. See the Date & Time category of Excels built-in functions for
more options.
By default, dates entered in a workbook are formatted to display two-digit years.
Use the Windows Control Panel to change the default date format if you want to
display four-digit years instead of two-digit years.
11
Choose the Values option and click OK. Excel replaces the formulas with their
values.
To replace just part of a formula with its value, select the cell that contains the
formula. In the formula bar, highlight the part of the formula you want to replace
with its calculated value. (When you select the part of the formula you want to
replace, make sure to include the entire thing. For example, if you select a
function, select the entire function name, the opening parenthesis, the arguments,
and the closing parenthesis.) Press the F9 key to force calculation of the selected
part of the formula. Then hit the Enter key. Excel replaces the selected part of the
formula with its calculated value.
12
If you assign names to cells after having used those cells in calculations, Excel
doesnt automatically replace cell references in the calculations with the new cell
names. However, you can over-ride this default and have new names used postformula-creation with the command Insert, Name, Apply.
Quickly name a cell or range by selecting it and entering the name in the Name
Box at the left of the formula bar. The Name Box displays the current cell or
range reference or the current cell or range name, if one is assigned.
Name a cell or range to be able to go to it quickly using the F5 Go To key.
Hitting F5 opens the Go To dialog box.
13
Range names for an Excel list (like the simple one below) can be used to
simplify references and in calculations.
In this example, select the list (the range B3:C7 in the illustration below)
and use Insert, Name, Create to open Excels Create Names dialog. Excel
guesses where the likely names are in relation to the data. In this case, the
data is in C4:C7 and the names come from the top row and left column.
With names established, you can use a shorthand reference to refer to the
numeric cells. Cell C4 can also be called January A since it falls at the
intersection of those row and column names. In like manner, Cell C5 can also be
referred to as January B.
Cell E5 contains the formula =January A and displays the value 10.
Cell E6 contains the formula = January A + January B and displays the value 25.
Theres another way to name a range whose values you intend to use
in a calculation: By using the special Label Ranges dialog. In this
example, imagine you have a list of values like the one at right, with
the label Year99 at the top of the column. Select the range (including
the label) and choose Insert, Name, Label to open the Label Ranges
dialog.
Year99
10
30
50
50
14
As a quicker alternative to using the Insert, Name, Label command, you can select
a range (not including its header) and use the Name Box to assign a range name.
Then use that range name in calculations, as above.
A named cell (or range) is treated as an absolute reference in a formula.
If you assign a cell or range a name and then want to change it, you can. But
Excel offers no simple method. The only way to change a range name is to use
Insert, Name, Define, add the new name, and then delete the old name.
15
2. Without having selected the list, issue the commands Insert, Name, Define to
open the Define Name dialog. Supply a name for the range when
prompted.
16
17
Then, add records to the list (or subtract records) and again, use the Go To
function with the dynamic range name. Even though the range size has changed,
Excel should again highlight the entire range.
Notes:
A dynamic range name constructed in this way will appear in the list of
worksheet range names when you choose Insert, Name, Define. However it
will not appear in the list of names in the drop-down Name Box on the
formula bar.
Because a dynamic named range is dependent on calculation, it can only be
referenced in an open workbook.
18
For each copied formula, Excel automatically adjusted the cell references to refer
to the data in the correct row. This is Excels default mode when copying
formulas. Its relative addressing.
19
There may be occasions, however, when you want to override Excels relative
addressing default. In the example below, the formula in Cell E4 (in the Tax
column) multiplies the Dept 1 Total Sales value (Cell D4) and the 5% value (Cell
B1). The result is correct for this row.
20
reference in a formula to the Tax value is written as $B$1. (Its also possible to
fix just the row but not the column by writing B$1 or just the column and not
the row by writing $B1. This is called mixed addressing.)
Tip: When positioned over a cell or range reference on the formula bar, the F4
key cycles through the four addressing options: completely relative, completely
absolute, absolute row but not column, and absolute column but not row. That is:
B1, $B$1, B$1, and $B1.
21
22
Array Formulas
An array formula can perform multiple calculations and then return either a
single result or multiple results. Array formulas act on one or more sets of values
known as array arguments. Each array argument must have the same number of
rows and columns. You create array formulas in the same way that you create
other formulas, except you press CTRL+SHIFT+ENTER to enter the formula.
In some cases Excel must perform several calculations to generate a single result.
For example, the worksheet below shows that a company has regional offices in
Europe and North America. Each region has three product divisions. You can
find the average revenue per product division for Europe in 1999 using a single
formula, provided you enter the formula as an array.
23
line values for the sales figures. To display the results of the formula, select the
three cells (C6:E6) before entering the formula.
In an array formula, where you might usually use a reference to a range of cells,
you can instead type the array of actual values contained within the cells. The
array of values you type is called an array constant. Use it when you dont want
to enter each value into a separate cell on the worksheet. To create an array
constant, you must do the following:
1. Enter the values directly into the formula, enclosed in braces ( { } )
2. Separate values in different columns with commas (,)
3. Separate values in different rows with semicolons (;)
For example, you can enter {10,20,30,40} in an array formula instead of entering
10, 20, 30, 40 in four cells in one row. This array constant is known as a 1-by-4
array and is equivalent to a 1-row-by-4-column reference. To represent the values
10, 20, 30, 40 in one row and 50, 60, 70, 80 in the row immediately below, you
would enter a 2-by-4 array constant: {10,20,30,40;50,60,70,80}.
24
Precision in Calculations
Regardless of the number of digits displayed, Excel stores numbers with up to 15
digits of precision. If a number contains more than 15 significant digits, Excel
converts the extra digits to zeros (0).
You can change the precision of the calculations in a workbook by directing
Excel to use the displayed (formatted) values instead of the underlying values.
To change the default, choose Tools, Options and select the Calculation tab.
Under Workbook options on that tab, toggle on the Precision as displayed
check box.
Use caution with this option, since Excel permanently changes any constant
values on the worksheets in the workbook. If you later decide you want to
calculate with full precision, the original underlying values cannot be restored.
25
Choose the type of series (Linear, Growth, Date, Autofill). Depending on this
selection, also select a Step value, Stop value, or Date unit.
Two Edit, Fill, Series examples:
26
Highlight a range of
numbers in your worksheet
and the Status Bar, by
default, reports the sum of
those numbers.
Right-clicking the sum
report on the Status Bar to
display a drop-down list of
other calculation options:
Average, Count, Count
Nums, Max, and Min.
27
Finding Formulas
Excels Go To feature provides a quick way to
identify all the calculations in your worksheet.
Click Edit, Go To or hit F5 to open the Go To
dialog.
28
Choose a default
update method.
In the Links dialog find the Source file list, click the source for the linked
object, and then click the Update Now button. To update links in a formula every
time you open the file that contains the formula or any time the original
information changes (while the dependent file is open), choose Automatic as
the default update method. To update a workbook with links only when you use
the Update Now button, choose the Manual update method.
Examples of when to use links
Link workbooks from several users or departments and then integrate the
key data into a summary workbook. Then when the source workbooks are
changed, you won't have to manually change the summary workbook. For
example, a group of sales offices may track data in individual workbooks; the
data is then rolled into a workbook that summarizes the data at the district
level, which is then rolled into a workbook that summarizes data at a
regional level. You have a hierarchy of links.
Streamline a large, complex model by breaking it down into a series of
interdependent worksheets or workbooks. Then work on sections of the
model without opening all of its related sheets. Smaller workbooks are easier
to change, don't require as much memory, and are faster to open, save, and
calculate.
30
Use the tools on the Auditing toolbar to locate problems and display cell
relationships.
For example, a circular reference occurs when a formula mistakenly
refers to itself and thus can't be resolved. Click the problem cell and use
the Trace Error button on the Auditing Toolbar to locate source of the
error.
Or, click the cell whose dependents or precedents you want to locate and
use the trace precedents or trace dependents icons on the Auditing
Toolbar. Excel draws arrows on the worksheet to show relationships
between cells. Use the erase precedent arrows icon or the erase
dependent arrows icons to erase the arrows when you're through.
31
32
The left-hand side of the dialog displays function categories. Click a category
name to see functions in that category in the list at right. Click a function in the
list at right and click the OK button to open a help dialog for that function.
For example, select the Financial category and the PMT function to open this
dialog. For whatever box your insertion point is in, a description is displayed.
33
Excel remembers the functions you last used and groups them in a category
named Most Recently Used. If youre not sure what category a function you want
might be in, select the All category. Then all the functions list in the box at right,
in alphabetical order.
When youre working with the dialog for a specific function, get more help about
that function by clicking the online help box at the lower left-hand corner of the
dialog.
34
Select a tool from the list and then provide the data and parameters (if necessary)
for the analysis. The tool displays the results in an output table. Some tools
generate charts in addition to output tables.
For example, to use the Descriptive Statistics tool, first assemble the data to
analyze on your worksheet.
Excels Analysis Tools are an add-in. If theyre not available in your installation of Excel, click
Tools, Add-Ins and select Analysis Toolpak. If the Analysis Toolpak isnt an option, rerun Excels
setup program.
1
35
Invoke the Descriptive Statistics tool from the Analysis Toolpak. A dialog specific
to that tool opens.
Complete the dialog and click OK to let the tool generate results. In the
illustration above, we specified an output range in the same worksheet for the
results data.
36
=IF(logical_test,value_if_true,value_if_false)
For example, the formula =IF(12>2,Correct,Not Correct) would return the
text value Correct. The formula =IF(12<2,Correct,Not Correct) would return
the text string Not Correct.
The condition part of the IF statement can use any comparison calculation
operator. That is, =, >, <, >=, <=, or <>.
Up to seven IF functions can be nested as value_if_true and value_if_false
arguments to construct more elaborate tests. However, a statement with more
than one or two embedded IF functions is hard to read and may be unnecessarily
complicated.
For example, using the data at left, you could use these nested IF statements to
return the correct grade:
If score is
Return
> 89
80 to 89
70 to 79
60 to 69
< 60
IF(Score>89,"A",
IF(Score>79,"B",
IF(Score>69,"C",
IF(Score>59,"D",
"F")
)
)
)
Four IF statements are included here. In the first one, a second IF statement is
included in place of the third parameter. In the second IF statement, another IF
statement is included in place of the third parameter. And so on.
37
Only the first part of the statement would be evaluated for a score of 90, but the
entire statement would need to be evaluated for a score of 58.
Excel permits up to seven levels of nesting in an IF statement.
The AND Function
The AND function can handle up to thirty conditions that can evaluate to true or
false. This function requires that all its arguments evaluate as true in order for
AND to evaluate to True. For example, the formula =AND(1<5,10>2) evaluates
to True. But the formula =AND(1<5,12<2) evaluates to False.
The OR Function
Like the AND function, the OR function can handle up to thirty conditions.
However, the OR function requires that only one of the arguments evaluate as
true in order to return true. So =OR(1<5,12<2) evaluates to True.
The NOT Function
The NOT function changes a TRUE outcome to a FALSE one and vice versa. For
example, =NOT(12>2) returns False.
Excel has additional functions you can use to analyze your data based on a
condition. For example, to count the number of occurrences of a string of text or
a number within a range of cells, use the COUNTIF worksheet function. To
calculate a sum based on a string of text or a number within a range, use the
SUMIF worksheet function.
38
39
To call this function in Excel, use the function name and pass it variables. For
example: =JCALC(A1, B1, C1)
40
41