Using Excel for M&V and Data Analysis

advertisement
Using Excel
for M&V and
Data Analysis
USING MICROSOFT EXCEL 2010 FOR M&V PURPOSES
Excel is an incredibly powerful tool, and every professional already has it on PC.
In fact, many professionals already use it for some form of data analytics without them
possibly realising such.
With a moderate level understanding and a bit of practice, a wide variety of tasks can be
performed using Excel, especially if you understand some of the standard features in Excel.
However, using Excel as a Data Analysis tool does have its advantages and disadvantages
e.g.:
Some of the Advantages using Excel as a tool
• You’ve already got it on your PC, so there’s no additional investment needed;
• You can get started right away;
• Most professionals already know the basics of Excel, some have advanced skills;
• Data can be fairly easily obtained in an Excel format (from source e.g. energy
metering);
• There are some good resources for using Excel as a tool on the internet e.g.:
http://www.dummies.com/how-to/computers-software/ms-office/Excel/Excel2010/Data/Analysis.html).
Some of the Disadvantages using Excel as a tool
• Excel has not been developed as a modeling tool and cannot easily perform the
standards-based energy analysis that’s required for accurate energy reporting;
• Excel wasn’t designed with audit tests in mind, so it can take time to setup or perform
each test;
• There will be no audit trail or logging of activity;
• It can be difficult to build long and complex formulas;
• There are some things that Excel just can’t do on its own, or requires extensive
complex programming.
Listed below are some of the standard features on Excel that can be used for basic day to
day data analytics in projects.
Page 1 of 66
STANDARD FEATURES IN EXCEL
This section illustrates the powerful features Excel has to offer to analyse data.
•
Sort: You can sort your Excel data on one column or multiple columns. You can sort
in ascending or descending order.
•
Filter: Filter your Excel data if you only want to display records that meet certain
criteria.
•
Conditional Formatting: Conditional formatting in Excel enables you to highlight cells
with a certain colour, depending on the cell's value.
•
Charts: A simple Excel chart can say more than a sheet full of numbers. As you'll
see, creating charts is very easy.
•
Pivot Tables: Pivot tables are one of Excel's most powerful features. A PivotTable
report is useful to summarize, analyse, explore, and present summary data.
•
Tables: Tables allow you to analyse your data in Excel quickly and easily.
•
Split Data into Multiple Columns: Use the Convert Text to Columns Wizard in Excel
2010 when you need to split combined data into separate columns, such as a date
field into year, month and day, first name and last name; or city, state, and zip code
etc.
•
What-If Analysis: What-If Analysis in Excel allows you to try out different values
(scenarios) for formulas.
•
Solver: Excel includes a tool called solver that uses techniques from the operations
research to find optimal solutions for all kind of decision problems.
•
Analysis ToolPak: The Analysis ToolPak is an Excel add-in program that provides
data analysis tools for financial, statistical and engineering data analysis.
•
Sampling: How to perform a random sample selection in Excel.
FUNCTIONS IN EXCEL
This section illustrates the most common functions in Excel.
Formulas and Functions: A formula is an expression which calculates the value of a cell.
Some functions are predefined formulas and are already available in Excel.
•
Count and Sum: The most used functions in Excel are the functions that count and
sum. You can count and sum based on one criteria or multiple criteria.
•
Logical: Use Excel's logical functions such as the IF, AND and OR function.
•
Text: Excel has many functions to offer when it comes to manipulating text strings.
•
Date & Time: To enter date and time in Excel. You can also enter a date and a time
in one cell.
•
Lookup & Reference: Use Excel's lookup & reference functions such as the
VLOOKUP, HLOOKUP, MATCH, INDEX and CHOOSE function.
•
Financial: Excel has most of the popular financial functions.
•
Statistical: Excel also has some very useful statistical functions.
Page 2 of 66
Back to Excel
Features Page
SORT
You can sort your Excel data on one column or multiple columns. You can sort in ascending
or descending order.
One Column - To sort on one column, execute the following steps.
1. Click any cell in the column you want to sort.
2. To sort in ascending order, on the Data tab, click AZ.
Result:
Note: to sort in descending order, click ZA.
Page 3 of 66
Back to Excel
Features Page
Multiple Columns - To sort on multiple columns, execute the following steps.
1. On the Data tab, click Sort.
The Sort dialog box appears.
2. Select e.g. Last Name from the 'Sort by' drop-down list.
3. Click on Add Level.
4. Select e.g. Sales from the 'Then by' drop-down list.
Page 4 of 66
Back to Excel
Features Page
5. Click OK.
Result: Records are sorted by Last Name first and Sales second.
Page 5 of 66
Back to Excel
Features Page
FILTER - Filter your Excel data if you only want to display records that meet certain criteria.
1. Click any single cell inside a data set.
2. On the Data tab, click Filter.
Arrows in the column headers appear.
3. Click the arrow next to Country.
4. Click on Select All to clear all the check boxes, and click the check box next to USA.
Page 6 of 66
Back to Excel
Features Page
5. Click OK.
Result: Excel only displays the sales in the USA.
6. Click the arrow next to Quarter.
7. Click on Select All too clear all the check boxes, and click the check box next to Qtr 4.
8. Click OK.
Result: Excel only displays the sales in the USA in Qtr 4.
Page 7 of 66
Back to Excel
Features Page
9. To remove the filter, on the Data tab, click Clear. To remove the filter and the arrows, click
Filter.
CONDITIONAL FORMATTING
Conditional formatting in Excel enables you to highlight cells with a certain colour,
depending on the cell's value.
Highlight Cells Rules
To highlight cells that are greater than a value, execute the following steps.
1. Select the range A1:A10.
Page 8 of 66
Back to Excel
Features Page
2. On the Home tab, click Conditional Formatting, Highlight Cells Rules, Greater Than...
3. Enter the value 80 and select a formatting style.
4. Click OK.
Result: Excel highlights the cells that are greater than 80.
Page 9 of 66
Back to Excel
Features Page
5. Change the value of cell A1 to 81.
Result: Excel changes the format of cell A1 automatically.
Note: you can also highlight cells that are less than a value, between a low and high value,
etc.
Clear Rules
To clear a conditional formatting rule, execute the following steps.
1. Select the range A1:A10.
Page 10 of 66
Back to Excel
Features Page
2. On the Home tab, click Conditional Formatting, Clear Rules, Clear Rules from Selected
Cells.
Top/Bottom Rules
To highlight cells that are above the average of the cells, execute the following steps.
1. Select the data range A1:A10.
Page 11 of 66
Back to Excel
Features Page
2. On the Home tab, click Conditional Formatting, Top/Bottom Rules, Above Average...
3. Select a formatting style.
4. Click OK.
Result: Excel calculates the average (42.5) and formats the cells that are above this
average.
Note: you can also highlight the top 10 items, the top 10 %, etc.
Page 12 of 66
Back to Excel
Features Page
To sort on column colour, execute the following steps.
1. On the Data tab, click Sort.
The Sort dialog box appears.
2. Select e.g. Last Name from the 'Sort by' drop-down list and select field name
3. Click on the Sort On drop down and select the colour
3. If you sort on more than one column - Click on Add Level.
Page 13 of 66
Back to Excel
Features Page
CHARTS
A simple chart in Excel can say more than a sheet full of numbers. As you'll see, creating
charts is fairly easy.
Create a Chart
To create a line chart, execute the following steps.
1. Select the data range. A1:D7.
2. On the Insert tab, in the Charts group, choose Line, and select Line with Markers.
Result:
Page 14 of 66
Back to Excel
Features Page
Change Chart Type
You can easily change to a different type of chart at any time.
1. Select the chart.
2. On the Insert tab, in the Charts group, choose Column, and select Clustered Column.
Result:
Page 15 of 66
Back to Excel
Features Page
Switch Row/Column
If you want the animals, displayed on the vertical axis, to be displayed on the horizontal axis
instead, execute the following steps.
1. Select the chart. The Chart Tools contextual tab activates.
2. On the Design tab, click Switch Row/Column.
Result:
Chart Title
To add a chart title, execute the following steps.
1. Select the chart. The Chart Tools contextual tab activates.
2. On the Layout tab, click Chart Title, Above Chart.
Page 16 of 66
Back to Excel
Features Page
3. Enter a title. For example: Population.
Result:
Legend Position
By default, the legend appears to the right of the chart. To move the legend to the bottom of
the chart, execute the following steps.
1. Select the chart. The Chart Tools contextual tab activates.
2. On the Layout tab, click Legend, Show Legend at Bottom.
Page 17 of 66
Back to Excel
Features Page
Result:
Data Labels
You can use data labels to focus your readers' attention on a single data series or data
point.
1. Select the chart. The Chart Tools contextual tab activates.
2. Click an orange bar to select the Jun data series. Click again on an orange bar to select a
single data point.
3. On the Layout tab, click Data Labels, Outside End.
Page 18 of 66
Back to Excel
Features Page
Result:
PIVOT TABLES
Pivot tables are one of Excel's most powerful features. A PivotTable report is useful to
summarize, analyse, explore, and present summary data
What is a PivotTable report?
A PivotTable report is an interactive way to quickly summarize large amounts of data. Use a
PivotTable report to analyse numeric data in detail and to answer unanticipated questions
about your data. A PivotTable report is especially designed for:
•
•
•
•
•
Querying large amounts of data in many user-friendly ways.
Subtotalling and aggregating numeric data, summarizing data by categories and
subcategories, and creating custom calculations and formulas.
Expanding and collapsing levels of data to focus your results, and drilling down
to details from the summary data for areas that are of interest to you.
Moving rows to columns or columns to rows (or "pivoting") to see different
summaries of the source data.
Filtering, sorting, grouping, and conditionally formatting the most useful and
interesting subset of data to enable you to focus on the information that you
want.
Page 19 of 66
Back to Excel
Features Page
Our data set consists of 214 rows and 6 fields. Order ID, Product, Category, Amount, Date
and Country.
Insert a Pivot Table
To insert a pivot table, execute the following steps.
1. Click any single cell inside the data set.
2. On the Insert tab, click PivotTable.
The following dialog box appears. Excel automatically selects the data for you. The default
location for a new pivot table is New Worksheet.
3. Click OK.
Page 20 of 66
Back to Excel
Features Page
Drag fields
The PivotTable field list appears. To get the total amount exported of each product, drag
the following fields to the different areas.
1. Product Field to the Row Labels area.
2. Amount Field to the Values area.
3. Country Field to the Report Filter area.
Below you can find the pivot table. Bananas are our main export product. That's how easy
pivot tables can be!
Page 21 of 66
Back to Excel
Features Page
Sort
To get Banana at the top of the list, sort the pivot table.
1. Click any cell inside the Total column.
2. The PivotTable Tools contextual tab activates. On the Options tab, click the Sort Largest
to Smallest button (ZA).
Result.
Filter
Because we added the Country field to the Report Filter area, we can filter this pivot table by
Country. For example, which products do we export the most to France?
1. Click the filter drop-down and select France.
Result. Apples are our main export product to France.
Page 22 of 66
Back to Excel
Features Page
Note: you can use the standard filter (triangle next to Product) to only show the totals of
specific products.
Change Summary Calculation
By default, Excel summarizes your data by either summing or counting the items. To change
the type of calculation that you want to use, execute the following steps.
1. Click any cell inside the Total column.
2. Right click and click on Value Field Settings...
3. Choose the type of calculation you want to use. For example, click Count.
Page 23 of 66
Back to Excel
Features Page
4. Click OK.
Result: 16 out of the 28 orders to France were 'Apple' orders.
Two-dimensional Pivot Table
If you drag a field to the Row Labels area and Column Labels area, you can create a twodimensional pivot table. For example, to get the total amount exported to each country, of
each product, drag the following fields to the different areas.
1. Country Field to the Row Labels area.
2. Product Field to the Column Labels area.
3. Amount Field to the Values area.
4. Category Field to the Report Filter area.
Page 24 of 66
Back to Excel
Features Page
Below you can find the two-dimensional pivot table.
To easily compare these numbers, create a pivot chart and apply a filter.
Filter
Page 25 of 66
Back to Excel
Features Page
TABLES
Tables allow you to analyse your data in Excel quickly and easily. Learn how to insert, sort
and filter a table, and how to display a total row at the end of a table.
Insert a Table
To insert a table, execute the following steps.
1. Click any single cell inside the data set.
2. On the Insert tab, click Table.
3. Excel automatically selects the data for you. Check 'My table has headers' and click on
OK.
Page 26 of 66
Back to Excel
Features Page
Result: Excel creates a nicely formatted table for you. This may still seem like a normal data
range to you but many powerful features are now just a click of a button away.
Note: the Table Tools contextual tab (with the underlying Design tab selected) is the starting
point for working with tables. If at any time you lose this tab, simply click any cell within the
table and it will activate again. Choose a table style you like. Hover over a table style and
Excel gives you a preview.
Sort a Table
To sort by Last Name first and Sales second, first sort by Sales, next sort by Last Name (the
exact opposite).
1. Click the arrow next to Sales and click Sort Smallest to Largest.
2. Click the arrow next to Last Name and click Sort A to Z.
Result:
Page 27 of 66
Back to Excel
Features Page
Filter a Table
To filter a table, execute the following steps.
1. Click the arrow next to Country and only check USA.
Result:
Page 28 of 66
Back to Excel
Features Page
Total Row
To display a total row at the end of the table, execute the following steps.
1. On the Design tab, in the Table Style Options group, check Total Row.
2. Click any cell in the last row to calculate the Total (Average, Count, Max, Min, Sum etc.) of
a column. For example, calculate the sum of the Sales column.
Note: in the formula bar see how Excel uses the SUBTOTAL function to calculate the sum.
109 is the argument for Sum if you use the SUBTOTAL function. Excel uses this function
(and not the standard SUM function) to correctly calculate table totals of filtered tables.
Page 29 of 66
Back to Excel
Features Page
SPLIT DATA INTO MULTIPLE COLUMNS
Use the Convert Text to Columns Wizard in Excel 2010 when you need to split combined
data into separate columns, such as a date field into year, month and day, first name and
last name; or city, state, and zip code etc. This type of combined data often results when you
open or import files created in another application.
1.
3.
If necessary, insert blank columns to the right of the cells you want to convert into
multiple columns. If you want your data in three columns, you must have two blank
columns.
Select the cells you want to convert. Note: You can't split empty cells, and you can't
split merged cells. You must first unmerge the cells.
Click the Text to Columns button in the Data Tools group on the Data tab.
4.
The Convert Text to Columns Wizard appears.
2.
5.
Select the Original Data type that best suits your existing data. If you're separating text
that is variable in length, such as a first name and last name, select Delimited. If all
cells contain a specific number of characters, choose Fixed Width.
6. Click Next.
The option you see next depends on which data type you selected in the previous step.
Page 30 of 66
Back to Excel
Features Page
Delimited View
If you selected Delimited in Step 4,
select (or type) the character you use to separate your text
Fixed Width View
If you selected Fixed Width, click
the ruler bar where you want the data to split.
Page 31 of 66
Back to Excel
Features Page
7.
Click Next. The third page of the wizard appears.
8.
Assign a data type to each column, if necessary. Select a column at the bottom of the
dialog box and then select a data type (General, Text, or Date) for each column. For
numbers other than dates, choose General; click the Advanced button to add a
thousands separator or to indicate how many decimal places to show.
Click Finish.
9.
Excel separates the selected cells into multiple columns. Note: If you did not insert blank
columns to the right of the cells you want to convert, it will overwrite the data in those cells.
Page 32 of 66
Back to Excel
Features Page
WHAT-IF ANALYSIS
What-If Analysis in Excel allows you to try out different values (scenarios) for formulas. The
following example helps you master what-if analysis quickly and easily.
Assume you own a book store and have 100 books in storage. You sell a certain % for the
highest price of $50 and a certain % for the lower price of $20.
If you sell 60% for the highest price, cell D10 calculates a total profit of 60 * $50 + 40 * $20 =
$3800.
Create Different Scenarios
But what if you sell 70% for the highest price? And what if you sell 80% for the highest price?
Or 90%, or even 100%? Each different percentage is a different scenario. You can use the
Scenario Manager to create these scenarios.
Note: You can simply type in a different percentage into cell C4 to see the corresponding
result of a scenario in cell D10. However, what-if analysis enables you to easily compare the
results of different scenarios. Read on.
1. On the Data tab, click What-If Analysis and select Scenario Manager from the list.
The Scenario Manager dialog box appears.
Page 33 of 66
Back to Excel
Features Page
2. Add a scenario by clicking on Add.
3. Type a name (60% highest), select cell C4 (% sold for the highest price) for the Changing
cells and click on OK.
4. Enter the corresponding value 0.6 and click on OK again.
Page 34 of 66
Back to Excel
Features Page
5. Next, add 4 other scenarios (70%, 80%, 90% and 100%).
Finally, your Scenario Manager should be consistent with the picture below:
Note: to see the result of a scenario, select the scenario and click on the Show button. Excel
will change the value of cell C4 accordingly for you to see the corresponding result on the
sheet.
Scenario Summary
To easily compare the results of these scenarios, execute the following steps.
1. Click the Summary button in the Scenario Manager.
2. Next, select cell D10 (total profit) for the result cell and click on OK.
Result:
Page 35 of 66
Back to Excel
Features Page
Conclusion: if you sell 70% for the highest price, you obtain a total profit of $4100, if you sell
80% for the highest price, you obtain a total profit of $4400, etc.
Goal Seek
What if you want to know how many books you need to sell for the highest price, to obtain a
total profit of exactly $4700? You can use Excel's Goal Seek feature to find the answer.
1. On the Data tab, click What-If Analysis, Goal Seek.
The Goal Seek dialog box appears.
2. Select cell D10.
3. Click in the 'To value' box and type 4700.
4. Click in the 'By changing cell' box and select cell C4.
5. Click OK.
Result. You need to sell 90% of the books for the highest price to obtain a total profit of
exactly $4700.
Page 36 of 66
Back to Excel
Features Page
SOLVER
Excel includes a tool called solver that uses techniques from the operations research to find
optimal solutions for all kind of decision problems.
Load the Solver Add-in
To load the solver add-in, execute the following steps.
1. On the green File tab, click Options.
2. Under Add-ins, select Solver Add-in and click on the Go button.
Page 37 of 66
Back to Excel
Features Page
3. Check Solver Add-in and click OK.
4. You can find the Solver on the Data tab.
Formulate the Model
The model we are going to solve looks as follows in Excel.
1. To formulate this linear programming model, answer the following three questions.
a. What are the decisions to be made? For this problem, we need Excel to find out how
much to order of each product (bicycles, mopeds and child seats).
Page 38 of 66
Back to Excel
Features Page
b. What are the constraints on these decisions? The constrains here are that the amount of
capital and storage used by the products cannot exceed the limited amount of capital and
storage (resources) available. For example, each bicycle uses 300 units of capital and 0.5
unit of storage.
c. What is the overall measure of performance for these decisions? The overall measure of
performance is the total profit of the three products, so the objective is to maximize this
quantity.
2. To make the model easier to understand, name the following ranges.
Range Name
Cells
UnitProfit
C4:E4
OrderSize
C12:E12
ResourcesUsed
G7:G8
ResourcesAvailable
I7:I8
TotalProfit
I12
3. Insert the following three SUMPRODUCT functions.
Explanation: The amount of capital used equals the sumproduct of the range C7:E7 and
OrderSize. The amount of storage used equals the sumproduct of the range C8:E8 and
OrderSize. Total Profit equals the sumproduct of UnitProfit and OrderSize.
Page 39 of 66
Back to Excel
Features Page
Trial and Error
With this formulation, it becomes easy to analyse any trial solution.
For example, if we order 20 bicycles, 40 mopeds and 100 child seats, the total amount of
resources used does not exceed the amount of resources available. This solution has a total
profit of 19000.
It is not necessary to use trial and error. We shall describe next how the Excel Solver can be
used to quickly find the optimal solution.
Solve the Model
To find the optimal solution, execute the following steps.
1. On the Data tab, click Solver.
Page 40 of 66
Back to Excel
Features Page
Enter the solver parameters (read on). The result should be consistent with the picture
below.
You have the choice of typing the range names or clicking on the cells in the spreadsheet.
2. Enter TotalProfit for the Objective.
3. Click Max.
4. Enter OrderSize for the Changing Variable Cells.
5. Click Add to enter the following constraint.
6. Check 'Make Unconstrained Variables Non-Negative' and select 'Simplex LP'.
7. Finally, click Solve.
Page 41 of 66
Back to Excel
Features Page
Result:
The optimal solution:
Conclusion: it is optimal to order 94 bicycles and 54 mopeds. This solution gives the
maximum profit of 25600. This solution uses all the resources available.
Page 42 of 66
Back to Excel
Features Page
ANALYSIS TOOLPAK
The Analysis ToolPak is an Excel add-in program that provides data analysis tools for
financial, statistical and engineering data analysis.
To load the Analysis ToolPak add-in, execute the following steps.
1. Click on the green File tab. The File tab in Excel 2010 replaces the Office Button (or File
Menu) in previous versions of Excel.
2. Click on Options.
3. Under Add-ins, select Analysis ToolPak and click on the Go button.
Page 43 of 66
Back to Excel
Features Page
4. Check Analysis ToolPak and click on OK.
5. On the Data tab, you can now click on Data Analysis.
The following dialog box below appears.
6. For example, select Histogram and click OK to create a Histogram in Excel.
Page 44 of 66
Back to Excel
Features Page
SAMPLING
Perform random sampling with Excel.
1. Insert two empty columns to the left of your data. To do this, you can rightclick within the A column and click "insert" twice. Alternatively, you can click into
the A column, select "Insert" from the menu bar, and click on "Columns."
2. Type = RAND() into your first empty cell and Enter. This should be in the A
column, under any heading row. The function will generate a random number
between 0 and 1 in that cell.
Page 45 of 66
Back to Excel
Features Page
3. Copy the =Rand() formula and paste it all the way down your A column. Make
sure that every piece of data in your set now has a random number next to it.
4. Highlight the whole column of random numbers. Copy these values.
5. Paste the random values in the B column. Make sure you use "Paste Special"
and select the "Values" option. This will tell Excel to copy the values but not the
formulas.
The RAND() formula recalculates a new random number each time you do
anything else in the spreadsheet, but copying the values over to a new column
will prevent them from changing in future.[1]
Page 46 of 66
Back to Excel
Features Page
6. Sort your random values. Select the whole B column. Click on the icon for sorting
(or go to "Data" in the menu bar and hit "Sort") and select "Ascending." Make
sure you select "Expand the Selection" and then "Sort" so that the other columns
are rearranged along with the B column.
7. Select your random sample. You can pick however many rows or cells you
want for your sample size. Just take the data you want, starting at the top of the
list, to make up your sample. Because they were ordered according to random
numbers, the sample will be a random selection from your data set, too.
Page 47 of 66
Back to Excel
Features Page
FORMULAS AND FUNCTIONS
A formula is an expression which calculates the value of a cell. Functions are predefined
formulas and are already available in Excel.
For example, cell A3 below contains a formula which adds the value of cell A2 to the value of
cell A1.
For example, cell A3 below contains the SUM function which calculates the sum of the range
A1:A2.
Enter a Formula
To enter a formula, execute the following steps.
1. Select a cell.
2. To let Excel know that you want to enter a formula, type an equal sign (=).
3. For example, type the formula A1+A2.
Tip: instead of typing A1 and A2, simply select cell A1 and cell A2.
4. Change the value of cell A1 to 3.
Page 48 of 66
Back to Excel
Features Page
Excel automatically recalculates the value of cell A3. This is one of Excel's most powerful
features!
Edit a Formula
When you select a cell, Excel shows the value or formula of the cell in the formula bar.
1. To edit a formula, click in the formula bar and change the formula.
2. Press Enter.
Operator Precedence
Excel uses a default order in which calculations occur. If a part of the formula is in
parentheses, that part will be calculated first. It then performs multiplication or division
calculations. Once this is complete, Excel will add and subtract the remainder of your
formula. See the example below.
Page 49 of 66
Back to Excel
Features Page
First, Excel performs multiplication (A1 * A2). Next, Excel adds the value of cell A3 to this
result.
Another example,
First, Excel calculates the part in parentheses (A2+A3). Next, it multiplies this result by the
value of cell A1.
Copy/Paste a Formula
When you copy a formula, Excel automatically adjusts the cell references for each new cell
the formula is copied to. To understand this, execute the following steps.
1. Enter the formula shown below into cell A4.
2a. Select cell A4, right click, and then click Copy (or press CTRL + c)...
...next, select cell B4, right click, and then click Paste under 'Paste Options:' (or press CTRL
+ v).
Page 50 of 66
Back to Excel
Features Page
2b. You can also drag the formula to cell B4. Click on the lower right corner of cell A4 and
drag it across to cell B4. This is much easier and gives the exact same result!
Result: The formula in cell B4 references the values in Column B.
Insert a Function
Every function has the same structure. For example, SUM(A1:A4). The name of this function
is SUM. The part between the brackets (arguments) means we give Excel the range A1:A4
as input. This function adds the values in cells A1, A2, A3 and A4. It's not easy to remember
which function and which arguments to use for a specific task. Fortunately, the Insert
Function feature in Excel helps you with this.
To insert a function, execute the following steps.
1. Select a cell.
2. Click the Insert Function button.
The 'Insert Function' dialog box appears.
3. Search for a function or select a function from a category. For example, choose COUNTIF
from the Statistical category.
Page 51 of 66
Back to Excel
Features Page
4. Click OK.
The 'Function Arguments' dialog box appears.
5. Click in the Range box and select the range A1:C2.
6. Click in the Criteria box and type >5.
7. Click OK.
Result: Excel counts the number of cells that are higher than 5.
Note: instead of using the Insert Function feature, simply type =COUNTIF(A1:C2,">5").
When you arrive at: =COUNTIF( instead of typing A1:C2, simply select the range A1:C2.
Page 52 of 66
Back to Excel
Features Page
COUNT AND SUM FUNCTIONS
The most used functions in Excel are the functions that count and sum. You can count and
sum based on one criteria or multiple criteria.
Count
To count the number of cells that contain numbers, use the COUNT function.
Countif
To count cells based on one criteria (for example, higher than 9), use the following
COUNTIF function.
Countifs
To count cells based on multiple criteria (for example, green and higher than 9), use the
following COUNTIFS function.
Page 53 of 66
Back to Excel
Features Page
Sum
To sum a range of cells, use the SUM function.
Sumif
To sum cells based on one criteria (for example, higher than 9), use the following SUMIF
function (two arguments).
To sum cells based on one criteria (for example, green), use the following SUMIF function
(three arguments, last argument is the range to sum).
Page 54 of 66
Back to Excel
Features Page
Sumifs
To sum cells based on multiple criteria (for example, blue and green), use the following
SUMIFS function (first argument is the range to sum).
General note: in a similar way, you can use the AVERAGEIF and AVERAGEIFS function to
average cells based on one or multiple criteria.
LOGICAL FUNCTIONS
Learn how to use Excel's logical functions such as the IF, AND and OR function.
If Function
The IF function checks whether a condition is met, and returns one value if TRUE and
another value if FALSE.
1. Select cell C2 and enter the following function.
The IF function returns Correct because the value in cell A1 is higher than 10.
And Function
The AND Function returns TRUE if all conditions are true and returns FALSE if any of the
conditions are false.
1. Select cell D2 and enter the following formula.
The AND function returns FALSE because the value in cell B2 is not higher than 5. As a
result the IF function returns Incorrect.
Page 55 of 66
Back to Excel
Features Page
Or Function
The OR function returns TRUE if any of the conditions are TRUE and returns FALSE if all
conditions are false.
1. Select cell E2 and enter the following formula.
The OR function returns TRUE because the value in cell A1 is higher than 10. As a result the
IF function returns Correct.
General note: the AND and OR function can check up to 255 conditions.
TEXT FUNCTIONS
Excel has many functions to offer when it comes to manipulating text strings.
Join Strings
To join strings, use the & operator.
Note: to insert a space, use " "
Left
To extract the leftmost characters from a string, use the LEFT function.
Right
To extract the rightmost characters from a string, use the RIGHT function.
Page 56 of 66
Back to Excel
Features Page
Mid
To extract a substring, starting in the middle of a string, use the MID function.
Note: started at position 5 (p) with length 3.
Len
To get the length of a string, use the LEN function.
Note: space (position 8) included!
Find
To find the position of a substring in a string, use the FIND function.
Note: string "am" found at position 3.
Substitute
To replace existing text with new text in a string, use the SUBSTITUTE function.
Page 57 of 66
Back to Excel
Features Page
DATE & TIME FUNCTIONS
To enter a date in Excel, use the "/" or "-" characters. To enter a time, use the ":" (colon).
You can also enter a date and a time in one cell.
Note: Dates are in US Format. Months first, Days second. This type of format depends on
your windows regional settings.
Year, Month, Day
To get the year of a date, use the YEAR function.
Note: use the MONTH and DAY function to get the month and day of a date.
Date Function
1. To add a number of days to a date, use the following simple formula.
2. To add a number of years, months and/or days, use the DATE function.
Note: the DATE function accepts three arguments: year, month and day. Excel knows that 6
+ 2 = 8 = August has 31 days and rolls over to the next month (23 August + 9 days = 1
September).
Current Date & Time
To get the current date and time, use the NOW function.
Note: use the TODAY function to get the current date only. Use NOW()-TODAY() to get the
current time only (and apply a Time format).
Page 58 of 66
Back to Excel
Features Page
Hour, Min, Sec
To return the hour, use the HOUR function.
Note: use the MINUTE and SECOND function to return the minute and second.
Time Function
To add a number of hours, minutes and/or seconds, use the TIME function.
Note: Excel adds 2 hours, 10 + 1 = 11 minutes and 70 - 60 = 10 seconds.
LOOKUP & REFERENCE FUNCTIONS
Learn all about Excel's lookup & reference functions such as the VLOOKUP, HLOOKUP,
MATCH, INDEX and CHOOSE function.
VLookup
The VLOOKUP (Vertical lookup) function looks for a value in the leftmost column of a table,
and then returns a value in the same row from another column you specify.
1. Insert the VLOOKUP function shown below.
Explanation: the VLOOKUP function looks for the ID (104) in the leftmost column of the
range $E$4:$G$7 and returns the value in the same row from the third column (third
argument is set to 3). The fourth argument is set to FALSE to return an exact match or a
#N/A error if not found.
2. Drag the VLOOKUP function in cell B2 down to cell B11.
Page 59 of 66
Back to Excel
Features Page
Note: when we drag the VLOOKUP function down, the absolute reference ($E$4:$G$7)
stays the same, while the relative reference (A2) changes to A3, A4, A5, etc.
HLookup
In a similar way, you can use the HLOOKUP (Horizontal lookup) function.
Page 60 of 66
Back to Excel
Features Page
Match
The MATCH function returns the position of a value in a given range.
Note: Yellow found at position 3 in the range E4:E7. The third argument is optional. Set this
argument to 0 to return the position of the value that is exactly equal to lookup_value (A2) or
a #N/A error if not found.
Index
The INDEX function returns a specific value in a two-dimensional or one-dimensional range.
Note: 92 found at the intersection of row 3 and column 2 in the range E4:F7.
Note: 97 found at position 3 in the range E4:E7.
Page 61 of 66
Back to Excel
Features Page
Choose
The CHOOSE function returns a value from a list of values, based on a position number.
Note: Boat found at position 3.
FINANCIAL FUNCTIONS
To illustrate Excel's most popular financial functions, we consider a loan with monthly
payments, an annual interest rate of 6%, a 20-year duration, a present value of $150,000
(amount borrowed) and a future value of 0 (that's what you hope to achieve when you pay
off a loan).
We make monthly payments, so we use 6%/12 = 0.5% for Rate and 20*12 = 240 for Nper
(total number of periods). If we make annual payments on the same loan, we use 6% for
Rate and 20 for Nper.
Pmt
Select cell A2 and insert the PMT function.
Note: The last two arguments are optional. For loans the Fv can be omitted (the future value
of a loan equals 0, however, it's included here for clarification). If Type is omitted, it is
assumed that payments are due at the end of the period.
Result. The monthly payment equals $1,074.65.
Tip: when working with financial functions in Excel, always ask yourself the question, am I
making a payment (negative) or am I receiving money (positive)? We pay off a loan of
$150,000 (positive, we received that amount) and we make monthly payments of $1,074.65
(negative, we pay).
Page 62 of 66
Back to Excel
Features Page
Rate
If Rate is the only unknown variable, we can use the RATE function to calculate the interest
rate.
Nper
Or the NPER function. If we make monthly payments of $1,074.65 on a 20-year loan, with an
annual interest rate of 6%, it takes 240 months to pay off this loan.
We already knew this, but we can change the monthly payment now to see how this affects
the total number of periods.
Conclusion: if we make monthly payments of $2,074.65, it takes less than 90 months to pay
off this loan.
PV
Or the PV (Present Value) function. If we make monthly payments of $1,074.65 on a 20-year
loan, with an annual interest rate of 6%, how much can we borrow? You already know the
answer.
Page 63 of 66
Back to Excel
Features Page
Fv
And we finish this chapter with the FV (Future Value) function. If we make monthly payments
of $1,074.65 on a 20-year loan, with an annual interest rate of 6%, do we pay off this loan?
Yes.
But, if we make monthly payments of only $1,000.00, we still have debt after 20 years.
STATISTICAL FUNCTIONS
Below you can find 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.
Page 64 of 66
Back to Excel
Features Page
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.
Page 65 of 66
Back to Excel
Features Page
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.
REFERENCES:
This document has been created, with minor additions and changes, from information taken
from the following websites:
http://www.excel-easy.com/data-analysis.html
http://www.excel-easy.com/functions.html
Page 66 of 66
Download