You are on page 1of 45

Pivot Table and Pivot Chart

• A pivot table is a data summarization tool


found in data visualization programs such as
spreadsheets.
• They can automatically sort, count, and total
the data stored in one table or spreadsheet
and create a second table displaying the
summarized data.
Pivot table
Pivot table
Pivot Chart
Pivot Chart
Goal Seek
• Goal Seek is used to get a particular result
when you're not too sure of the starting value.
• For example, if the answer is 56, and the first
number is 8, what is the second number?
• Is it 8 multiplied by 7, or 8 multiplied by 6?
You can use Goal Seek to find out.
Steps of Goal Seek
• From the Excel menu bar, click on Data
• Locate the Data Tools panel and the What if
Analysis item. From the What if Analysis
menu, select Goal Seek
• Then one dialogue box appears
Example Goal seek
• Your business has a modest profit of 25,000.
You've set yourself a new profit Goal of
35,000. At the moment, you're selling 1000
items at 25 each. Assume that you'll still sell
1000 items. The question is, to hit your new
profit of 35,000, by how much do you have to
raise your prices?
Example-Goal seek

The formula to enter for B4 is this:


= B2 * B3
And the formula to enter for E4 is this:
= E2 * E3
Example-Goal Seek
• The current Price Per Item is 25.00. We want
to change this with Goal Seek, because our
prices will be going up to hit our new profits of
35,000. So try this:
Goal seek
Analysis pack
• Load the Analysis ToolPak
• Click the Microsoft Office Button , and then click Excel Options.
• Click Add-Ins, and then in the Manage box, select Excel Add-ins.
• Click Go.
• In the Add-Ins available box, select the Analysis ToolPak check
box, and then click OK. Tip  If Analysis ToolPak is not listed in the
Add-Ins available box, click Browse to locate it.
• If you get prompted that the Analysis ToolPak is not currently
installed on your computer, click Yes to install it.
• After you load the Analysis ToolPak, the Data Analysis command
is available in the Analysis group on the Data tab.
Solver
• The Microsoft Excel solver add-in is one of the
features that makes creating engineering and
financial models in a spreadsheet a powerful
tool.
• Example 1: "Finding a Local Minimum Using
the Excel Solver"
Example
• Let's say we have the following equation, and we want
to find the value of x that minimizes f subject to -1 <=
x <= 5.
• f=x2-x+2
• Our objective function is the value that we are going to
minimize (f). The design variables are the variables
that we are going to allow the Solver to change (just x
in this example). We have two constraints: -1 <= x and
x <= 5
• We have two constraints: -1 <= x and x <= 5
Example
• We need to choose a starting value for x, so
let's choose x = 1

Cell B11 (The Objective


Function): =B15^2-B15+2
Example
• To use the Excel solver add in (Tools > Solver ...)
• we choose our objective function, cell B11, to
be the "Target Cell" and choose the "Min"
option (see Figure 2 below).
• Our only design variable is x, so the only cell we
are going to change is B15. After adding the
two constraints, we click on the Solve button,
and we find our answer (x=0.5).
Example
Solving a System of Non-Linear Equations

Notice that these equations are in implicit form (equal to zero). To solve the system,
we will create an objective function that when minimized, drives both equations to
zero. Minimizing the sum of the squares of each implicit equation will accomplish
this.
Example
Run the Solver Using a VBA Macro
• If you need to solve the same system of
equations or run an optimization routine a
number of times using the same model, it is
convenient to create a macro that can be run
by pressing a single button.
• Let's use the problem from Example .
Solver-Macro
• Step 1: Start the macro recorder (Tools > Macro > Record New
Macro ...).
• Step 2: Open the solver dialog box (Tools > Solver ...).
• Step 3: Clear any existing solver settings (Press the Reset All button).
• Step 4: Choose the target cell, design variables, and constraints and
press the Solve button. Then select OK to accept the results.
• Step 5: Stop the macro recorder (Tools > Macro > Stop Recording ...).
• Step 6: Add a button to the worksheet, using a button from the
Forms toolbar. (If the Forms toolbar is not displayed, right-click on
any toolbar and click on "Forms".)
• Step 7: Assign the macro you created to the button. (Right-click on
the button and choose "Assign Macro ...")
Solver-Macro
• The VBA code for the Solver macro that was recorded for Example 2 is
shown below.
• Sub SolverMacro()
• ' Example Solver VBA Macro
• SolverReset
• SolverOk SetCell:="$B$24", _
• MaxMinVal:=2, _
• Value Of:="0", _
• ByChange:="$B$16:$B$17"
• SolverSolve userFinish:=True
• End Sub
•  
Linear Programming & Excel
• Production planning problem
• A company manufactures four variants of the
same product and in the final part of the
manufacturing process there are assembly,
polishing and packing operations. For each
variant the time required for these operations
is shown below (in minutes) as is the profit per
unit sold.
LP Problem in Excel
• Assembly Polish Pack Profit (£)
• Variant 1 2 3 2 1.50
• 2 4 2 3 2.50
• 3 3 3 2 3.00
• 4 7 4 5 4.50
LP & Excel
• Given the current state of the labor force the company estimate
that, each year, they have 100000 minutes of assembly time,
50000 minutes of polishing time and 60000 minutes of packing
time available. How many of each variant should the company
make per year and what is the associated profit?
• Suppose now that the company is free to decide how much
time to devote to each of the three operations (assembly,
polishing and packing) within the total allowable time of
210000 (= 100000 + 50000 + 60000) minutes. How many of
each variant should the company make per year and what is the
associated profit?
LP & Excel
• Variables
• Let:
• xi be the number of units of variant i (i=1,2,3,4) made
per year
• Tass be the number of minutes used in assembly per year
Tpol be the number of minutes used in polishing per year
Tpac be the number of minutes used in packing per year
• where xi >= 0 i=1,2,3,4 and Tass, Tpol, Tpac >= 0
Lp & Excel
• Constraints
• (a) operation time definition
• Tass = 2x1 + 4x2 + 3x3 + 7x4 (assembly)
Tpol = 3x1 + 2x2 + 3x3 + 4x4 (polish)
Tpac = 2x1 + 3x2 + 2x3 + 5x4 (pack
• (b) operation time limits
• The operation time limits depend upon the situation being considered. In the first
situation, where the maximum time that can be spent on each operation is specified,
we simply have:
• Tass <= 100000 (assembly)
Tpol <= 50000 (polish)
Tpac <= 60000 (pack)
• In the second situation, where the only limitation is on the total time spent on all
operations, we simply have:
• Tass + Tpol + Tpac <= 210000 (total time)
LP & Excel
• Objective
• Presumably to maximise profit - hence we
have
• maximise 1.5x1 + 2.5x2 + 3.0x3 + 4.5x4
• which gives us the complete formulation of
the problem
LP & Excel
• The answer report can be seen below:

We can see that the optimal solution to the LP has value 58000 (£) and that
Tass=82000, Tpol=50000, Tpac=60000, X1=0, X2=16000, X3=6000 and X4=0.
Transportation
• A company can produce four different types of
devices identified as A, B, C and D. The
minimum amounts of devices are Amin, Bmin,
Cmin and Dmin. The maximum amounts are
defined as Amax, Bmax, Cmax and Dmax. The
prices of the devices are Ac, Bc, Cc and Dc
Transportation
Device Min amount Max amount Price, $
A 650 1000 4.5
B 1700 2200 5.5
C 1100 1400 6.5
D 880 1300 7.0
Transportation
• There are three machines available to produce
the devices: M1, M2 and M3. Each machine
can operate from Tmin to Tmax minutes:

Machine \ Time Tmin, min Tmax, min


M1 55000 65000
M2 60000 69000
M3 62000 68000
Transportation
• The time required to produce each devices on
each machine (T) are given in the table (in
minutes.
Machine \
A B C D
Device
M1 10 12 8 18
M2 14 11 10 17
M3 13 10 11 20

So, time to produce device A on machine M1 is denote as T_A_M1 and so on.


The amounts of devices are required to be found that maximize the profit.
The decision variables are amount of devices of each type: Ax, Bx, Cx and Dx.
Transportation
• The objective function is sum of multiplications of
devices amounts and their costs:
F = Ax * Ac + Bx * Bc + Cx * Cc + Dx * Dc

There are several constraints:


T_A_M1 * Ax + T_B_M1 * Bx + T_C_M1 * Cx +
T_D_M1 * Dx >= Tmin for M1 T_A_M1 * Ax +
T_B_M1 * Bx + T_C_M1 * Cx + T_D_M1 * Dx <=
Tmax for M1 and etc. The problem has been solved
successfully with the following plan:
Transporatation
Device Amount
A 650
B 2200
C 1400
D 1107

The Total Profit is $31877.5


Linear Regression
• A linear regression is just a statistical tool used
to determine whether or not two (or more)
variables are linearly related. 
• Suppose you want to determine whether a
person's salary is a function of his or her
education level (measured in years).
The general form of the relationship is:
• Yi = a + bXi + errori
Linear Regression
• where:
• Yi = value of Y (salary) for observation i
• a  = average value of Y (salary) when X (education) is zero
• b = average change in Y (salary) given a one unit increase
in X (education), i.e. the average increase in salary for
each    additional year of education.
• Xi = value of X (education) for observation i .
• errori = portion of Y (salary) that is unrelated to X
(education), i.e. due to other factors (age, years on job,
etc.)
Linear Regression
• The Regression analysis tool performs linear
regression analysis by using the "least squares"
method to fit a line through a set of
observations.
• You can analyze how a single dependent
variable is affected by the values of one or more
independent variables.
• The Regression tool uses the worksheet
function LINEST.
Regression
• The effect of a price increase upon demand, or the
effect of changes in the money supply upon the
inflation rate.
• Let E denote education in years of schooling for each
individual, and
• let I denote that individual’s earnings in dollars per year.
• We can plot this information
• for all of the individuals in the sample using a two-
dimensional diagram, conventionally termed a “scatter”
diagram.
Regression
• Then, the hypothesized relationship between education
and earnings may be written
• I = a + bE + e
• where
• a = a constant amount (what one earns with zero
education);
• b = the effect in dollars of an additional year of schooling
on income, hypothesized to be positive;
• e = the “noise” term reflecting other factors that
influence earn
Multiple Regression
• “Multiple regression” is a technique that allows
additional factors to enter the analysis separately
so that the effect of each can be estimated.
• It is valuable for quantifying the impact of
various simultaneous influences upon a single
dependent variable.
• The modified model may be written:
• I = a + bE + gX + e
Correlation
• Correlation coefficient between two measurement
variables when measurements on each variable are
observed for each of N subjects.
• The Correlation analysis tool is particularly useful
when there are more than two measurement
variables for each of N subjects.
• It provides an output table, a correlation matrix, that
shows the value of CORREL (or PEARSON) applied to
each possible pair of measurement variables.
Correlation
• The correlation coefficient, like the covariance, is a
measure of the extent to which two measurement
variables "vary together."
• Unlike the covariance, the correlation coefficient is scaled
so that its value is independent of the units in which the
two measurement variables are expressed.
• For example, if the two measurement variables are weight
and height, the value of the correlation coefficient is
unchanged if weight is converted from pounds to
kilograms.) The value of any correlation coefficient must be
between -1 and +1 inclusive.
Covariance
• The Correlation and Covariance tools can both be used in the
same setting, when you have N different measurement
variables observed on a set of individuals.
• The Correlation and Covariance tools each give an output
table, a matrix, that shows the correlation coefficient or
covariance, respectively, between each pair of measurement
variables.
• The difference is that correlation coefficients are scaled to lie
between -1 and +1 inclusive. Corresponding covariances are not
scaled. Both the correlation coefficient and the covariance are
measures of the extent to which two variables "vary together."
Covariance
• The Covariance tool computes the value of the worksheet
function COVAR for each pair of measurement variables.
• (Direct use of COVAR rather than the Covariance tool is a
reasonable alternative when there are only two
measurement variables, that is, N=2.)
• The entry on the diagonal of the Covariance tool's output
table in row i, column i is the covariance of the i-th
measurement variable with itself.
• This is just the population variance for that variable, as
calculated by the worksheet function VARP.

You might also like