Академический Документы
Профессиональный Документы
Культура Документы
Average | Averageif | Median | Mode | Standard Deviation | Min | Max | Large | Small
This chapter gives an overview of some very useful statistical functions in Excel.
Average
To calculate the average of a range of cells, use the AVERAGE function.
Averageif
To average cells based on one criteria, use the AVERAGEIF function. For example, to calculate the
average excluding zeros.
Note: <> means not equal to. The AVERAGEIF function is similar to the SUMIF function.
Median
To find the median (or middle number), use the MEDIAN function.
Check:
Mode
To find the most frequently occurring number, use the MODE function.
Standard Deviation
To calculate the standard deviation, use the STEDV function.
Min
To find the minimum value, use the MIN function.
Max
To find the maximum value, use the MAX function.
Large
To find the third largest number, use the following LARGE function.
Check:
Small
To find the second smallest number, use the following SMALL function.
Check:
Tip: Excel can generate most of these results with the click of a button. Our Descriptive
Statistics example shows you how.
Descriptive Statistics
You can use the Analysis Toolpak add-in to generate descriptive statistics. For example, you may have
the scores of 14 participants for a test.
To generate descriptive statistics for these scores, execute the following steps.
1. On the Data tab, click Data Analysis.
Note: can't find the Data Analysis button? Click here to load the Analysis ToolPak add-in.
2. Select Descriptive Statistics and click OK.
6. Click OK.
Result:
This How-To Geek School class is intended for people who use Excel, or try to use Excel,
but are intimidated by the concept of formulas and functions. Its objective is to make you an
Excel pro or at least a competent amateur in just a few lessons.
SCHOOL NAVIGATION
1.
2.
3.
4.
5.
Note: for the uninitiated, this is the very first lesson in the first series for How-To Geek
School. We will be running a new lesson each weekday, Monday through Friday, from now
until weve covered every subject. So stay tuned for more, and well be making a formal
announcement about how it works next week.
What is Excel and Why Do We Need It?
If you are an office administrator, you probably use Excel. Ditto if you are a salesman. If you
are a financial analyst, of course, you need Excel. For these and many other professions,
working with spreadsheets is an essential tool in the daily routine.
People who are math wizards will probably immediately take to Excel and use it like a
natural extension of their computational processes. Most of the rest of us probably need
some help in that department.
If you did not pay attention in high school algebra class, dont fret! All you need to do is
learn some basic knowledge of formulas and functions from this How-To Geek School
series and apply them to your work.
If you dont know whether or not you need Microsoft Excel, then you probably have not
been shown what it can do. Once you do know, then you can find ways to use it in your
work to make complicated and tedious tasks easier.
Microsoft Excel is more than just a program to enter names and numbers. For example, if
you simply want to list the names of students in your class then you can just make a Word
document. Word is fine for writing essays and making lists but to do calculations, you need
Excels formulas and functions.
A Brief Tour of the Excel Interface
Before we dive in, lets just briefly review the Excel interface. You may already know all this
stuff, but it never hurts to review.
When you open a blank Excel spreadsheet, it is known as a workbook or book and each
spreadsheet in a book is a known as a worksheet or sheet.
The top of the app is dominated by the ribbon (gray), which subdivided into tabs (red),
which are then further sub-divided into sections (blue).
Below the ribbon is the name box, which lets you rename cells and then to the right of
that is an area that allows you to create your all-important formulas. If you hover over each
icon, you can see the purpose of each button, but what were most concerned with is the
wide area where our formulas and functions will be displayed.
Finally, the worksheet is arranged in columns (denoted by letters) and rows (indicated by
numbers). Each location is a cell and a group of cells is known as a range. If you have
multiple sheets in a book, you can quickly flip through them using the tabs seen below the
sheet. Below that, in the gray status bar, you can adjust your page views and zoom level.
Thats it, pretty simple, and just a short overview of some of the terminology youll encounter
in this HTG School series.
What is a Function?
A function is a calculation or operation that returns a result. The inputs in a function are
called arguments.
All functions begin with an equals sign [=]. That way Excel knows not to treat the arguments
as text. For example, =AVERAGE(2,4) is a function but AVERAGE(2,4) is just a string of
text. Without an equals sign, Excel will not calculate a result. The arguments in this function
are 2 and 4.
Note, Excel uses upper-case letters to list functions, but you can use lower or upper-case
letters when you write them.
In Excel, the Function Library can be found on the Formulas tab.
Logical: IF() the IF() function is written like =IF(<test>, then A, else B). So, if test
is true, then the result is A; if test is not true, then B.
Lookup and Reference: These are needed to lookup values elsewhere in the
spreadsheet. For example, VLOOKUP looks in a table of values to find one cell.
How could you use this last one? Well, to get the day of the week in text from a date
function. You can use VLOOKUP to scan a table to turn this number into something easier
to understand, like Wednesday.
There are also special functions for financial, engineering, and statistics which are listed
separately on the More Functions menu.
What is a Formula?
In Excel, you can write this using the formula =PI() * radius ^ 2.
Here, PI() is the function that returns the number 3.14 and radius is a name we have
given to a cell that contains the radius; the operators are the exponent (^) and multiplier
(*).
Order and Precedence
Parentheses are used to indicate the order and precedence in calculations.
The area of a circle can also we written rr but not (r) 2, so you need to understand order
and precedence to get right answer. Exponents are evaluated before multiplication, so
parentheses are not needed in this case. The function squares the radius first then
multiplies that by Pi.
If you wanted to eliminate any possible doubt you could be explicit and write =Pi * (radius
^2).
We will explore order and precedence further in Lesson 2.
Coming up Next
For the remainder of this series, we will concentrate on a four key areas:
Lesson 2: Defining and Creating Formulas
To get started, the first item to explore is how to create formulas and understand the basic
rules:
Calculation operators
The new formula says B1*2. You can use the dollar sign ($) to anchor the cell reference so
that copying it does not change where it points (dont worry, we cover this in a bit).
Lesson 4: Useful Functions You Should Get to Know
This lesson explains some of most commonly-used functions and how we can apply them in
useful calculations and how to nest functions.
To nest a function means put one function inside another. For example, if you want to know
what day today is, write =WEEKDAY(NOW()).
NOW() gives todays date and WEEKDAY() turns it into a number from 1 to 7. NOW() is
nested inside WEEKDAY().
Lesson 5: Advanced Functions: If, Nested-If, and Lookups
If you want to create complex models or algorithms, you will need to know how to combine
logic and lookup functions including IF and nested IF statements and lookups including
VLOOKUP and HLOOKUP.
An example of lookup function would be =COLUMN(). This gives the column number of a
cell reference, e.g., A=COLUMN(A1).
Well also briefly cover pivot tables. A pivot table is used to extract meaning from data. For
example you could take a list of sales and group them by region or sales person to give you
the
In this lesson we discuss cell references, how to copy or move a formula, and format cells.
To begin, lets clarify what we mean by cell references, which underpin much of the power
and versatility of formulas and functions. A concrete grasp on how cell references work will
allow you to get the most out of your Excel spreadsheets!
SCHOOL NAVIGATION
1.
2.
3.
4.
5.
Note: were just going to assume that you already know that a cell is one of the squares in
the spreadsheet, arranged into columns and rows which are referenced by letters and
numbers running horizontally and vertically.
What is a Cell Reference?
A cell reference means the cell to which another cell refers. For example, if in cell A1 you
have =A2. Then A1 refers to A2.
Lets review what we said in Lesson 2 about rows and columns so that we can explore cell
references further.
Cells in the spreadsheet are referred to by rows and columns. Columns are vertical and
labeled with letters. Rows are horizontal and labeled with numbers.
The first cell in the spreadsheet is A1, which means column A, row 1, B3 refers to the cell
located on the second column, third row, and so on.
For learning purposes about cell references, we will at times write them as row, column, this
is not valid notation in the spreadsheet and is simply meant to make things clearer.
Types of cell references
Now, suppose we need to make room in our spreadsheet for more data. We need to add
columns above and rows to the left, so we have to move the cell down and to the right to
make room.
As you move the cell to the right, the column number increases. As you move it down, the
row number increases. The cell that it points to, the cell reference, changes as well. This is
illustrated below:
Continuing with our example, and looking at the graphic below, if you copy the contents of
cell A1 two to the right and four down you have moved it to cell C5.
We copied the cell two columns to the right and four down. This means we have changed
the cell it refers two across and four down. A1=A2 now is C5=C6. Instead of referring to A2,
now cell C5 refers to cell C6.
The value shown is 0 because cell C6 is empty. In cell C6 we type I am C6 and now C5
displays I am C6.
Write the formula =RIGHT(A3,LEN(A3) FIND(,,A3) 1) or copy the text to cell C3. Do
not copy the actual cell, only the text, copy the text, otherwise it will update the reference.
You can edit the contents of a cell at the top of a spreadsheet in the box next to where is
says fx. That box is longer than a cell is wide, so it is easier to edit.
Now we have:
Nothing complicated, we have just written a new formula into cell C3. Now copy C3 to cells
C2 and C4. Observe the results below:
When we copied the cells from column C to column B it updated the reference one column
to the left =RIGHT(A2,LEN(A2) FIND(,,A2) 1).
It changed every reference to A2 to the column to the left of A, but there is no column to the
left of column A. So the computer does not know what you mean.
The new formula in B2 for example, is =RIGHT(#REF!,LEN(#REF!) FIND(,,#REF!) 1)
and the result is #REF:
Copying cells is very handy because you can write one formula and copy it to a large area
and the reference is updated. This avoids having to edit each cell to ensure it points to the
correct place.
By range we mean more than one cell. For example, (C1:C10) means all the cells from
cell C1 to cell C10. So it is a column of cells. Another example (A1:AZ1) is the top row from
column A to column AZ.
If a range cross five columns and ten rows, then you indicate the range by writing the topleft cell and bottom right one, e.g., A1:E10. This is a square area that cross rows and
columns and not just part of a column or part of a row.
Here is an example that illustrates how to copy one cell to multiple locations. Suppose we
want to show our projected expenses for the month in a spreadsheet so we can make a
budget. We make a spreadsheet like this:
Now copy the formula in cell C3 (=B3+C2) to the rest of the column to give a running
balance for our budget. Excel updates the cell reference as you copy it. The result is shown
below:
As you can see, each new cell updates relative to the new location, so cell C4 updates its
formula to =B4 + C3:
Absolute References
An absolute reference does not change when you move or copy a cell. We use the $ sign to
make an absolute reference to remember that, think of a dollar sign as an anchor.
For example, enter the formula =$A$1 in any cell. The $ in front of the column A means do
not change the column, the $ in front of the row 1 means do not change the column when
you copy or move the cell to any other cell.
As you can see in the example below, in cell B1 we have a relative reference =A1.When we
copy B1 to the four cells below it, the relative reference =A1 changes to the cell to the left,
so B2 become A2, B3 become A3, etc. Those cells obviously have no value inputted, so the
output is zero.
However, if we use =$A1$1, such as in C1 and we copy it to the four cells below it, the
reference is absolute, thus it never changes and the output is always equal to the value in
cell A1.
Suppose you are keeping track of your interest, such as in the example below. The formula
in C4 = B4 * B1 is the interest rate * balance = interest per year.
Now, you have changed your budget and have saved an additional $2,000 to buy a mutual
fund. Suppose it is a fixed rate fund and it pays the same interest rate. Enter the new
account and balance into the spreadsheet and then copy the formula = B4 * B1 from cell C4
to cell C5.
The new budget looks like this:
The new mutual fund earns $0 in interest per year, which cant be right since the interest
rate is clearly 5 percent.
Excel highlights the cells to which a formula references. You can see above that the
reference to the interest rate (B1) is moved to the empty cell B2. We should have made the
reference to B1 absolute by writing $B$1 using the dollars sign to anchor the row and
column reference.
Rewrite the first calculation in C4 to read =B4 * $B$1 as shown below:
Then copy that formula from C4 to C5. The spreadsheet now looks like this:
Since we copied the formula one cell down, i.e. increased the row by one, the new formula
is =B5*$B$1. The mutual fund interest rate is calculated correctly now, because the interest
rate is anchored to cell B1.
This is a good example of when you could use a name to refer to a cell. A name is an
absolute reference. For example, to assign the name interest rate to cell B1, right-click the
cell and then select define name.
Names can refer to one cell or a range, and you can use a name in a formula, for example
=interest_rate * 8 is the same thing as writing =$B$1 * 8.
Mixed References
Now you want to know the value of your inventory of seeds. You need the price per pound
and the number of pounds in inventory to know the value of the inventory.
We add two columns: pound of seed in inventory and then value of inventory. Now, copy
the cell D2 to F4 and note that the row reference in the first part of the original formula ($B2)
is updated to row 4 but the column remains fixed because the $ anchors it to B.
This is a mixed reference because the column is absolute and the row is relative.
Circular References
Excel only tells you that you have a circular reference at the bottom of the screen so you
might not notice it. If you do have a circular reference and close a spreadsheet and open it
again, Excel will tell you in a pop-up window that you have a circular reference.
If you do have a circular reference, every time you open the spreadsheet, Excel will tell you
with that pop-up window that you have a circular reference.
References to Other Worksheets
A workbook is a collection of worksheets. Simply put, this means you can have multiple
spreadsheets (worksheets) in the same Excel file (workbook). As you can see in the
example below, our example workbook has many worksheets (in red).
Worksheets by default are named Sheet1, Sheet2, and so forth. You create a new one by
clicking the + at the bottom of the Excel screen.
You can change the worksheet name to something useful like loan or budget by rightclicking on the worksheet tab shown at the bottom of the Excel program screen, selecting
rename, and typing in a new name.
The syntax for a worksheet reference is =worksheet!cell. You can use this kind of reference
when the same value is used in two worksheets, examples of that might be:
Todays date
Below is an example of worksheet interest making reference to worksheet loan, cell B1.
If we look at the loan worksheet, we can see the reference to the loan amount:
Coming up Next
We hope you now have a firm grasp of cell references including relative, absolute, and
mixed. Theres certainly a lot.
Thats it for todays lesson, in Lesson 4, we will discuss some useful functions you may wish
to know for daily Excel use.
This example teaches you how to calculate the moving average of a time series in Excel. A moving
avearge is used to smooth out irregularities (peaks and valleys) to easily recognize trends.
1. First, let's take a look at our time series.
Note: can't find the Data Analysis button? Click here to load the Analysis ToolPak add-in.
3. Select Moving Average and click OK.
4. Click in the Input Range box and select the range B2:M2.
5. Click in the Interval box and type 6.
6. Click in the Output Range box and select cell B3.
7. Click OK.
Explanation: because we set the interval to 6, the moving average is the average of the previous 5
data points and the current data point. As a result, peaks and valleys are smoothed out. The graph
shows an increasing trend. Excel cannot calculate the moving average for the first 5 data points
because there are not enough previous data points.
9. Repeat steps 2 to 8 for interval = 2 and interval = 4.
Conclusion: The larger the interval, the more the peaks and valleys are smoothed out. The smaller the
interval, the closer the moving averages are to the actual data points.
Go
Histogram
Descriptive Statistics
Anova
F-Test
t-Test
Moving Average
Exponential Smoothing
Correlation
Regression
moving-average.xls
In this lesson well discuss categories of functions what they do and various examples
and to illustrate how they work, well show you several example spreadsheets. We
encourage you to follow along by creating your own spreadsheets.
SCHOOL NAVIGATION
1.
2.
3.
4.
5.
There are many other functions, of course, and by no means are these the only ones that
you should learn. Were just giving you a set of really useful functions that youll need to use
on a regular basis. The next lesson will demonstrate some more advanced functions that
you might use, but a little less often.
Math and Financial Functions
Again, this is not a complete list of math or financial functions, but an example of a few that
you should get to know. We recommend testing them in a spreadsheet of your own.
Functions
Purpose
SQRT
PMT
Loan payment
DEGREES
GCD
RAND(23)
In this example, 1 means pick the first column in the range and =INDEX() is a function that
retrieves the value of a cell (Jam.es =1 so he is our winner).
If you want to pick another name such as if the winner must be present to win then all
you need to do is change the spreadsheet. You can try it yourself, simply change the width
of a column or add data. Anytime the spreadsheet updates, it regenerates a new random
number and picks a new winner.
Logical Functions
Purpose
IF
AND
FALSE
TRUE
Dates are stored in excel as numbers, which means you can do math with them. You can
use +1 to calculate the next day and you can subtract one date from another to find how
many days have elapsed between two dates.
Formula
Result
Purpose
=NOW()
9/16/2013
=DATEVALUE(9/16/2013)
41533
=WEEKDAY(NOW())
=NOW()+1
9/17/2013
For example, Excel cannot simply add =9/16/2013 + 1. It must first convert it to a number
that makes sense to it. In the screenshot, you see we first had to assign the DATEVALUE()
function to the formula so Excel knows the texts value is a date.
The boss says you can take vacation based upon your sales. If you make $1 million in sales
you get two weeks (10 working days). If you make $10 million in sales you get three weeks
(15 working days). Make less than $1 million in sales and you get a new job elsewhere.
You are a great salesman, so youre planning to make at least $10 million in sales and do it
quickly. You estimate it will take you fifty days to meet your quota. You want to project when
you can go on vacation, so you make a spreadsheet.
To find the vacation date, you cannot simply add 50 days to the first of the year. It has to be
50 working days not including holidays. Further, since no one wants to go on holiday in
the middle of the week, you have to find the following Saturday, unless the date calculated
already is a Saturday.
How do you do this calculation? Lets look closely at the spreadsheet below:
If you project $15 million in sales, then enter that value in cell B2. You also estimate it will
take 50 work days to reach that goal, which you enter into B3.
From here, we can calculate what date it will be 50 work days from January 1, and then
display the following Saturdays date your first day of vacation!
The formula =WORKDAY(B1,B3,A13:A20) adds B3 (50 work days) to B1 (January 1)
excluding the holidays listed in the range A13:A20.
Next, you must find the next Saturday. This is a bit tricky. The whole formula is
=IF(WEEKDAY(B4)=7,7,7-WEEKDAY(B4))+B4.
To explain, remember that Friday and Saturday are the 6 th and 7th week days, respectively.
March 14, which is our projected first day well be eligible to go on vacation is March 14 (cell
B4), which is a Friday (6).
We then take the number 7 (Saturday) and subtract the value from B4.
Once Excel determines how many days difference there is between your projected vacation
day and the following Saturday, it adds that difference, in this case 1, to the value in B4, and
displays it in B5.
Once you determine when to go on vacation, you can figure out when to come back. If your
sales are greater than or equal to $1,000,000 then you have 10 vacation days. If they are
greater than or equal to $10,000,000, you get 15 vacation days.
The formula were going to use to determine our return date is
=IF(B2>=A10,WORKDAY(B11,B5),WORKDAY(B11,B4)).
Here we first determine the value of B2 (sales made) and then compare it to the value in
A10 ($10,000,000).
If the value is greater than or equal to $10,000,000, then the formula will add 15 days to cell
B5 and print the result in B6, which is your return date.
Otherwise, it will add the value in B9 (10 days) and print that in B6.
We dont care about holidays because we will be on vacation, so we do not include them in
the WORKDAY() function.
Sadly, as useful as this is, Excel still cannot tell you whether you will even want to return to
work once your vacation ends!
Coming up Next
Wrapping up today, you should have a decent working knowledge of math and financial
functions, logical functions, and date and time functions. Tomorrow, in our final Lesson 5 to
this class, we will explore reference functions, the solver, financial functions, and how to
create a pivot table.