Excel 2010 Formulas
Excel 2010 Formulas
________________________________________________________
Office 2010
Excel
Formulas
September 2014
________________________________________________________
CONTENTS
INTRODUCTION ................................................................................................... 1
WHAT IS A FORMULA? ........................................................................................... 3
EXAMPLES OF FORMULAS ............................................................................................... 3
ARITHMETIC OPERATORS ............................................................................................... 4
COPYING A FORMULA TO ADJACENT CELLS .......................................................................... 7
HIERARCHY OF OPERATIONS ................................................................................... 8
PARENTHESES ............................................................................................................ 9
FUNCTIONS ....................................................................................................... 10
AUTOSUM BUTTON ..................................................................................................... 11
INSERT FUNCTION ...................................................................................................... 14
EXERCISES ............................................................................................................... 16
DISPLAYING FORMULAS ........................................................................................ 17
DISPLAYING VALUES .................................................................................................... 17
PERCENTAGES .................................................................................................... 18
CALCULATING THE PERCENTAGE DIFFERENCE BETWEEN TWO NUMBERS ....................................... 18
INCREASE OR DECREASE A VALUE BY A PERCENTAGE.............................................................. 18
EXERCISES- PRACTICE SHEET 1 ....................................................................................... 18
RELATIVE AND ABSOLUTE REFERENCES .................................................................... 19
RELATIVE REFERENCE .................................................................................................. 19
ABSOLUTE REFERENCE ................................................................................................. 19
USING ABSOLUTE REFERENCES ....................................................................................... 20
EXERCISES- PRACTICE SHEET 2 ....................................................................................... 21
CONDITIONAL FORMULA ....................................................................................... 22
IF ......................................................................................................................... 22
COUNTIF & COUNTIFS.................................................................................................. 26
SUMIF & SUMIFS ........................................................................................................ 28
EXERCISES- PRACTICE SHEET 3 ....................................................................................... 29
Excel 2010 Getting Started (310712) i ©De Montfort University, IT Training 2012
INTRODUCTION
This introductory level course is aimed at those who want to learn spreadsheet basics
using Microsoft Excel.
Knowledge assumed
experience of using a computer, for example keyboard
and mouse familiarity
experience of using Windows, for example familiarity
with icons, loading software, opening files and saving
files
Areas covered
worksheet structure
formatting cells
printing from a spreadsheet
using formulae and functions
relative and absolute references
manipulating worksheets
simple charts
Excel 2010 Getting Started (310712) 1 ©De Montfort University, IT Training 2012
Document signposts
Shortcuts
Reminders
Notes
Exercises
Excel 2010 Getting Started (310712) 2 ©De Montfort University, IT Training 2012
WHAT IS A FORMULA?
Formulas are what make a spreadsheet so useful. Using formulas lets you calculate
results from the data stored in the worksheet.
When you create a formula, you use cell references to identify the data to be included
in the calculation. By using cell references, rather than the values themselves, you
ensure that any changes to the values in the cells referenced by the formulas
automatically result in an updated answer.
A formula always commences with an equals sign (=) to indicate that what follows is an
instruction, not a value.
EXAMPLES OF FORMULAS
In the example worksheet below, cells D2 and D3 both contain formulas to add the
respective cells in columns B and C.
A B C D
1 JAN FEB TOTAL
2 PETROL 15.00 20.00 =15.00+20.00
3 OIL 5.00 14.50 =B3+C3
Look at cell D2
The intention of this formula is to add together the values in cells B2 and C2 (15 plus
20). If the value in either cell changes, the formula will not take this into account and
you will need to remember to alter the values in D2, otherwise the resulting figure will
no longer be correct. This formula, therefore, is not very useful.
Look at cell D3
The formula specifies the cell references (B3 and C3) rather than the current values of
these cells. If you change the values in either or both cells, there is no need to worry
about the formula in D3. Because the formula uses cell references, the resulting figure
will be updated automatically.
Excel 2010 Getting Started (310712) 3 ©De Montfort University, IT Training 2012
ARITHMETIC OPERATORS
Operator Example
+ (plus sign) Addition (3+3)
– (minus sign) Subtraction (3–1)
Negation (–1)
* (asterisk) Multiplication (3*3)
/ (forward slash) Division (3/3)
% (percent sign) Percent (20%)
^ (caret) Exponentiation (3^2)
You will now open the workbook JumbleSales.xlsx from the ExcelFormulas folder on
drive C.
ADDITION
In A20 enter 12
In B20 enter 4
To add these two values together and display the result in C20:
Press Enter
This formula instructs Excel to add the contents of cell A20 to the contents of B20. C20
displays the value 16 (12+4=16).
After you have created a formula, any changes to the cells in the formula, automatically
result in an updated answer.
In B20 type 10
Press Enter
Excel 2010 Getting Started (310712) 4 ©De Montfort University, IT Training 2012
MULTIPLICATION
Press Enter
Press Enter
SUBTRACTION
Press Enter
DIVISION
Press Enter
Excel 2010 Getting Started (310712) 5 ©De Montfort University, IT Training 2012
CALCULATING THE TOTAL PAY
In cell D3 you are going to enter the formula to calculate the Total for John Markshaw
(Hourly Rate * Hours Worked).
Click on cell D3
Type =
The formula is =B3*C3, but instead of typing the cell references you will learn a quick
way to insert cell references into a formula.
The cell is highlighted and its reference is added to the formula in D3.
Type *
The cell is highlighted and its reference is added to the formula in D3.
Press Enter
Excel 2010 Getting Started (310712) 6 ©De Montfort University, IT Training 2012
COPYING A FORMULA TO ADJACENT CELLS
If you are copying a formula (remember that you usually see the result of the formula
rather than the formula itself), the cell references change automatically relative to the
row and column of the cell it is being copied to.
You now need to calculate the Total for the remaining employees.
Rather than create a formula for each one, you can copy the formula entered for John
Markshaw into the remaining cells in the Total column.
Click on cell D3
Move the mouse pointer over the fill handle (the cursor will change to a thin black +)
Click and hold down the left mouse button and drag the fill handle over the range D4
to D15
Excel 2010 Getting Started (310712) 7 ©De Montfort University, IT Training 2012
HIERARCHY OF OPERATIONS
As you already know, a formula in Excel always begins with an equals sign (=). Following
the equals sign are the elements to be calculated which are separated by operators (+, -
, *, / etc). However, you should be aware that Excel does not always calculate the
formula from left to right.
=2+2*6
Press Enter
If you combine several operators in a single formula, Excel performs the operations in
the following order:
In the above formula Excel deals with the multiplication first (2 * 6 = 12) and then the
addition (2 + 12) giving a total of 14.
Excel 2010 Getting Started (310712) 8 ©De Montfort University, IT Training 2012
PARENTHESES
To change the order of evaluation (to override the built-in order of precedence between
*, /, + and -), you use parentheses.
You will enter the same formula again, but this time enclosing the first part in
parentheses.
Press Enter
Excel dealt with the calculation in the parentheses first and then multiplied the result.
You can appreciate, therefore, how important it is that you understand how Excel deals
with the elements in a formula, before you create complex formulas.
Excel 2010 Getting Started (310712) 9 ©De Montfort University, IT Training 2012
FUNCTIONS
Name Calculates…
SUM The total value
MIN The minimum value
MAX The maximum value
AVERAGE The average value
COUNT The number of cells containing numbers
COUNTA The number of non-empty cells
COUNTBLANK The number of blank cells
For example, a range of cells could begin at D2 and end at D16. In this case you would
express the range as D2:D16 – the colon in this situation can be interpreted as the word
“to”. So D2:D16 means D2 to D16.
D2:D16
To total the range of cells above without using a function, your formula would look like
this:
=D2+D3+D4+D5+D6+D7+D8+D9+D10+D11+D12+D13+D14+D15+D16
=SUM(D2:D16)
Excel 2010 Getting Started (310712) 10 ©De Montfort University, IT Training 2012
You can enter functions into your worksheet in three different ways:
AUTOSUM BUTTON
You are required to add up all the figures in the Total column to calculate the
company’s monthly salary expenditure, and display the value in D17.
Select the cell in which the total is to appear – in this case D17
Excel automatically selects a range for you (indicated by a dashed box around the cells).
You should always check to ensure that the range that is selected is correct – do not
assume that Excel has got it right!
If this range is correct (it should cover all of the figures in column D) press Enter
Excel 2010 Getting Started (310712) 11 ©De Montfort University, IT Training 2012
If the range is not correct then you can either:
Click into the Formula Bar and type the correct range before pressing Enter
Or
Highlight the required range using the mouse pointer and then press Enter
With D17 selected, click the down arrow next to the AutoSum button
This gives you quick access to some of the most common functions.
Click Average
Excel 2010 Getting Started (310712) 12 ©De Montfort University, IT Training 2012
Check to ensure that the range selected is correct (i.e. all the numbers in column D
are selected)
Press Enter
Click the Undo button on the Quick Access Toolbar to undo the average function
Undo
This dialog box can be accessed in various ways and is the general method used for
inserting most of the functions that are available in Excel.
Click Cancel
Excel 2010 Getting Started (310712) 13 ©De Montfort University, IT Training 2012
INSERT FUNCTION
Another way to access the Insert Function dialog box is to use the Insert Function
button on the Formula Bar.
For this exercise you will use a function in A17 to display the number of employees listed
on the spreadsheet. The function needed is called COUNTA.
The default category is Most Recently Used. If the function you require is not listed
then it is recommended to use the All category to find your function.
Click the down arrow in the Or select a category box and select All. Scroll down the
list to find the function you want.
Alternatively a quick way to find a function is to use the Search facility. Type
COUNTA in the search box and select Go.
Excel 2010 Getting Started (310712) 14 ©De Montfort University, IT Training 2012
The Function Arguments dialog box is displayed.
In the Value 1 box type: A3:A15 (this is the range of cells that we want the function
to count). Alternatively you could have selected the cell range using your mouse.
Click OK
This function works by counting the number of non-empty cells in the range that you
specify. It therefore counts the number of names in A3:A15 and returns the value 13.
Excel 2010 Getting Started (310712) 15 ©De Montfort University, IT Training 2012
EXERCISES
In cell C19 use the SUM function to calculate the total number of Hours Worked by
all the employees (i.e. sum the range from C3 to C15)
Copy this formula to cell D19 to calculate the total pay for all the employees
In C20, use the AVERAGE function to calculate the average number of hours worked
In D22, use the MAX function to calculate the Maximum salary from the Total
column, ensuring that you specify the correct range
In D23 use the MIN function to calculate the Minimum salary from the Total column,
again ensuring that the range is correct
Excel 2010 Getting Started (310712) 16 ©De Montfort University, IT Training 2012
DISPLAYING FORMULAS
When you select a cell, you can see the formula (if there is one) displayed in the
Formula Bar. It is also possible to view the formulas used in the entire worksheet.
DISPLAYING VALUES
To display/hide formulas
Press and hold the key and press the key at the top left of the
keyboard.
Excel 2010 Getting Started (310712) 17 ©De Montfort University, IT Training 2012
PERCENTAGES
There are several ways to use percentages in formulas and this section will look at some
useful calculations that you may use in your spreadsheet.
You are going to work out what percentage increase the staff have received in their
salary within the last year.
This formula divides the difference between the second and first numbers, by the first
number to get the percentage change.
You are going to work out the new salary when a 5% bonus is added to their current total
pay.
N.B To work out a decrease you would use the following formula: =D3*95% or D3-(D3*5%)
Excel 2010 Getting Started (310712) 18 ©De Montfort University, IT Training 2012
RELATIVE AND ABSOLUTE REFERENCES
RELATIVE REFERENCE
By default, formulas in Excel use relative cell references. This means that, as a formula
is copied and pasted to other cells, the cell references in the formula change to reflect
the formula’s new location. The example below shows the effect of copying the formula
in cell C1 to other cells in column C.
A B C
1 6 3 18 (=A1*B1)
2 4 2 8 (=A2*B2)
3 10 4 40 (=A3*B3)
However, let’s say that in column C you want to produce a formula that will multiply
cell A1 by a series of cells in column B.
A B C
1 6 3 18 (=A1*B1)
2 2 12 (=A1*B2)
3 4 24 (=A1*B3)
To achieve this, the reference to cell A1 needs to be changed from a relative reference
to an absolute one before copying the formula down the column.
ABSOLUTE REFERENCE
An absolute cell reference in a formula does not change when the formula is copied and
pasted into other cells.
In the formula above, to make the reference to cell A1 absolute, and therefore ensure
that it remains unchanged when it is copied to other cells, you include $ signs ($A$1).
The diagram below illustrates what happens when the formula in C1 is changed to
=$A$1*B1 and then copied down to other cells in column C.
The absolute reference ($A$1) has remained unchanged, and the relative reference (B1)
has changed to, B2 and B3 respectively.
A B C
1 6 3 18 (=$A$1*B1)
2 2 12 (=$A$1*B2)
3 4 24 (=$A$1*B3)
Excel 2010 Getting Started (310712) 19 ©De Montfort University, IT Training 2012
USING ABSOLUTE REFERENCES
Type =B3*A19*E3
Press Enter
You now need to copy this formula down the column to calculate the overtime pay for
the other employees.
Select cell F3
Before copying the formula you must first decide if any of the references need to be
absolute.
The Hourly rate figure changes for each employee and therefore this needs to be a
relative reference.
The Overtime hours figure changes for each employee and therefore this also needs to
be a relative reference.
However, the Overtime rate figure is the same for every employee and this is stored in
A19. Therefore A19 must be made into an absolute reference.
Position the insertion point in the Formula Bar and edit the formula so that the
reference to cell A19 is made absolute by including $ signs
A quick way to make a cell reference absolute is to use the F4 key on your keyboard
=B3*$A$19*E3
Remember to press Enter when you have finished editing the formula.
Excel 2010 Getting Started (310712) 20 ©De Montfort University, IT Training 2012
Copy the formula down the column to all employees
Click on the overtime pay for some of the other employees to see that while the
hourly rate and overtime hours references have copied relatively, the overtime rate
reference is absolute
As some staff have worked overtime, this figure must be added to their pay.
Select cell G3 ready to calculate the Total Pay for John Markshaw
Copy the amended formula down to the other staff – you do not need to make any
part of this formula absolute
To finish this exercise, use the SUM function in cell G17 to total the column
Excel 2010 Getting Started (310712) 21 ©De Montfort University, IT Training 2012
CONDITIONAL FORMULA
IF
The IF function is one of the most important functions in Excel as it can give your
formulas decision-making capabilities.
The IF function includes a logical test, that compares a cell against a specified value. A
logical test is a test that produces an answer of either True or False.
If the Value is text rather than a number, it must be enclosed in quotation marks
(“text”).
For example, you might want to include the words “solvent” or “bankrupt” as the result
of a calculation in the worksheet.
You can compare two values with the following operators. When two values are
compared using these operators, the result is a logical value, either TRUE or FALSE.
Excel 2010 Getting Started (310712) 22 ©De Montfort University, IT Training 2012
The management of Jumble Sales Corporation has decided that staff who earn £7.50 or
less per hour will receive a bonus of £20 and all others will get £10.
Therefore, the bonus depends on each member of staff’s hourly rate. So the logical test
must check to see if the hourly rate is £7.50 or less.
Click OK
Excel 2010 Getting Started (310712) 23 ©De Montfort University, IT Training 2012
The Function Arguments dialog box for the IF function is displayed.
There are three boxes to complete, and the first one is the logical test.
You must test to see if the hourly rate is £7.50 or less. The hourly rate value is in B3, so
you are testing to see if B3 is £7.50 or less.
This will check to see if B3 is less than or equal to 7.5. The pound sign ‘£’ is not
included because this is just formatting.
● A cell reference
● An operator
● A value
This gives a bonus of £10 if the hourly rate is more than £7.50.
Click OK
Excel 2010 Getting Started (310712) 24 ©De Montfort University, IT Training 2012
E3 displays John Markshaw’s bonus as 20.
=IF(B3<=7.5,20,10)
If the test is
true return the
value, 20
Copy the formula down the column to the other members of staff
Look down the Bonus payment column to check that the figures are correct
Excel 2010 Getting Started (310712) 25 ©De Montfort University, IT Training 2012
COUNTIF & COUNTIFS
The standard functions that are used to count cells in a range are COUNT, COUNTA and
COUNTBLANK.
The COUNTIF function enables you to count only the cells that satisfy a specific criteria.
Where:
The next example shows how to count the number of memberships depending on the
type.
In C112 use the Insert Function button and locate the COUNTIF function:
Ensure your cursor is in the Range box and highlight the range H7 to H108.
Place your cursor in the Criteria box and select the cell B112
This will set the criteria to Gold as that is the content of cell B112
Click OK.
Ensure you have selected cell C112 and look at your formula bar. Your formula should
look like this:
=COUNTIF(H7:H108,B112)
This formula can now be copied for the other membership types. However, for it to
work some cells will need to be made absolute.
You should have made the range H7:H108 absolute in order for your formula to work
when copied.
Excel 2010 Getting Started (310712) 26 ©De Montfort University, IT Training 2012
COUNTIFS works in the same way but can take multiple pairs of criteria range and
criteria.
You need to find the number of staff in the Brokerage department with Gold
memberships:
In G112 use the Insert Function button to locate the COUNTIFS function.
In the Criteria1 box insert the text “gold” (notice that another box has now
appeared so you can add a second criteria)
You could keep adding criteria but we have finished for this example
Select OK
The answer is 6.
The above formula counts the number of rows where gold is present in column H AND
brokerage is present in column G.
Excel 2010 Getting Started (310712) 27 ©De Montfort University, IT Training 2012
SUMIF & SUMIFS
The SUMIF function is used to sum data in a selected range when specified conditions are
met.
The standard SUM function can be used to calculate the total Annual Fee, but if you
need to calculate the total Annual Fee for the Maintenance department, or the total
Annual Fee for the Maintenance staff who joined after 1995, then either SUMIF or
SUMIFS will need to be used.
Where:
criteria range is the range where you want to look for a specific condition
criteria is the value or condition to look for in the criteria range
sum range is the range you want to sum once the above criteria has been met
Sum range and criteria range must have equal length and shape.
SUMIFS allows you to have multiple criteria range and criteria pairs which enables you to
sum data that satisfies many different criteria.
For the first example you will calculate the total Annual Fee for the Sales department.
In G115, use the Insert Function button to locate the SUMIF function
=SUMIF(G7:G108,”brokerage”,I7:I108)
Explanation:
g7:g108 is the criteria range (the range in which to look for the criteria)
“brokerage” is the criterion to look for in g7:g108 (text must be enclosed within
double quotes)
i7:i108 is the sum range (the range of cells to be summed. This can be left blank
if it is the same range as the criteria)
Excel 2010 Getting Started (310712) 28 ©De Montfort University, IT Training 2012
Next you will calculate the total Annual Fee for members of the Brokerage department
who joined after 1995.
In G118, use the Insert Function button to locate the SUMIFS function:
=SUMIFS(i7:i108,g7:g108,“brokerage”,d7:d108,“>31/12/1995”)
Explanation:
The function sums the cells in the sum range for the rows that satisfy both conditions.
Excel 2010 Getting Started (310712) 29 ©De Montfort University, IT Training 2012