You are on page 1of 9

L.

Jimnez

P&G

L. Jimnez

P&G

Using Excel Solver for everyday problems


Laureano.Jimenez@urv.cat Department of Chemical Engineering University Rovira i Virgili Tarragona, Spain
L. Jimnez

Easy things I have to say

Laureano Jimnez Esteller

234
P&G 3

Topics for today


1. Easy things I have to say
A bit of history

What is an spreadsheet?
Columns and rows Cells:
Text: Values: =, +, Formula: =, +, Parenthesis:

2. Practical issues 3. Case studies:


Toy example Logistics, inventory, allocation, scheduling, finances

4. Complex aspects:
VBA
L. Jimnez P&G 2

L. Jimnez

P&G

July 2012

July 2012

L. Jimnez

P&G

L. Jimnez

P&G

Mental calculations?
+3*5^2 = ? +3+2*5 = ? +2/3/5 = ?
+(2/3)/5 = ? +2/(3/5) = ?

Useful formula
SUMPRODUCT
=D2*D4+E2*E4+F2*F4+G2*G4+H2*H4 +I2*I4 is a tedious procedure = sumproduct(d2:i2; d4:i4) is a timesaving short cut

Order matters
L. Jimnez P&G 5 L. Jimnez P&G 7

Easy things, I have to say...


Copy & paste: Everything is relative (F2): references highlighted in color!

Adding names to ranges


Highlight names and values
2003: Insert/Name/Create/Left column 2007: Formulas/Defined Names tab/Create from Selection/Left column

(F4): to fix references $


Insert/function +exp(B4) +suma(B1:F10) +cos(2*A5-B3)
L. Jimnez P&G 6 L. Jimnez

Result

P&G

July 2012

July 2012

L. Jimnez

P&G

L. Jimnez

P&G

A bit of history1
Equations were written in verse (except in Egypt) =: Robert Recorde, 1557 Using horoscope, he predicted long life to a prince who died (almost) simultaneously. He recalculate, and said that it was a calculation mistake
L. Jimnez P&G 9

A bit of history3
: John Wallis, physician Exponents: Nicolas Chuquet, physician Unknown: Franois Viete to decode letters. He was imprisoned by the Inquisition. Uses capital letters (vowels for unknown and consonants for the known) Descartes used lowercase x, y, z
L. Jimnez P&G 11

A bit of history2
+ i -: Wildmann, 1489 Mark if boxes had a bit more (+) or a bit less () x: William Oughtred, 1631 > i <: Thomas Harriot, 1625, physician : Rudolff, 1525, physician Cubic root:
L. Jimnez P&G 10

A bit of history4
Bombelli: parenthesis, impossible known as number (later imaginary)
Euler defined i

L. Jimnez

P&G

12

July 2012

July 2012

L. Jimnez

P&G

L. Jimnez

P&G

Activating Solver@Excel 2003

Practical issues

1
L. Jimnez

34
P&G 15 L. Jimnez P&G 17

What is the Solver?


Add-in for Microsoft Excel to solve easy/medium optimization problems
Minimize or maximize an objective function subject to constraints by changing a set of parameters

Activating Solver@Excel 2007

Can be used solve simultaneous equations, problems that requires iteration... Finding maximum, minimum, or value Dont need to guess and check Sensitive to initial value
L. Jimnez P&G 16 L. Jimnez

Data tab

P&G

18

July 2012

July 2012

L. Jimnez

P&G

L. Jimnez

P&G

Activating Solver@Excel 2010

Solver

If not in the active list, then Go (Manage Excel Add-ins)

Data tab

L. Jimnez

P&G

19

L. Jimnez

P&G

21

Using Solver
Tools
Solver

Case studies

12
L. Jimnez P&G 20 L. Jimnez

4
P&G 22

July 2012

July 2012

10

L. Jimnez

P&G

L. Jimnez

P&G

Toy example
H, W, and L are the height, width, and length of a box Size limitations on boxes shipped are
Their circumference is at most 100 inches: C = 2H + 2W 100 The sum of their dimensions is at most 120 inches: S = H + W + L 120

The requirement that the circumference be at most 100 inches is a constraint. The contents of Cell E7 must be at most 100
Cell that computes circumference

<= OK Enter the limiting number

You would like to know the dimensions a box that has the largest volume: V = HWL

Repeat the process to add the constraint F7 <= 120


L. Jimnez P&G 23 L. Jimnez P&G 25

FRAGILE Crush slowly L

H
W

Solve

Cell that computes volume Select Max Cells that contain dimensions Add OK Keep Solver Solution

L. Jimnez

P&G

24

L. Jimnez

P&G

26

July 2012

11

July 2012

12

L. Jimnez

P&G

L. Jimnez

P&G

Complex aspects
In some cases (such as very large or small initial values of H, W, or L) you may need to add the constraints B7 >= 0, C7 >= 0 and D7 >= 0

123
27 L. Jimnez P&G 29

L. Jimnez

P&G

Case studies
1. 2. 3. 4. 5. Logistics Inventory Allocation Scheduling Finances

Excel, Macros, and VBA


Macro: a set of recorded key strokes or program written in Visual Basic (VB) to automate tasks Visual Basic for Applications (VBA)
An implementation of VB integrated into MS Office applications
Enables user to write VB code to automate tasks and much more

L. Jimnez

P&G

28

L. Jimnez

P&G

30

July 2012

13

July 2012

14

L. Jimnez

P&G

L. Jimnez

P&G

Accessing Macros@Excel 2003


Tools/Macro

Recording Macros
Excel 2003
Tools/Macro/Record New Macro

Excel 2007
View/Macros/Macros (menu)/Record Macro

L. Jimnez

P&G

31

L. Jimnez

P&G

33

Accessing Macros@Excel 2007


View/Macro

Security working with Macros


Be careful with macro enabled files!
Excel 2003: set security level to medium Excel 2007: *.xlsx: macro disabled workbooks (default) *.xlsm: macro enabled workbooks Can write and work with a macro in a .xlsx file, but you can only save the macro to a .xlsm file You may need to modify Macro Settings
Office button|Excel Options|Trust Center Settings|Macro Settings|Disable all macros with notification

L. Jimnez

P&G

32

L. Jimnez

P&G

34

July 2012

15

July 2012

16

L. Jimnez

P&G

VB editor

L. Jimnez

P&G

35

Using Excel Solver for everyday problems


Laureano.Jimenez@urv.cat Department of Chemical Engineering University Rovira i Virgili Tarragona, Spain

Laureano Jimnez Esteller

July 2012

17

You might also like