7/28/2019 2012 New Orleans Health 13
1/36
2012 Health Meeting
June 13- 15, 2012
Session #13 PD: Best Practices for
Excel Design and Controls
Johann K. Leida, Ph.D., FSA, MAAA
Alisa Johnson Widmer, FSA, MAAASteven F. Wright, FSA
Primary Competency
Technical Skills & Analytical Problem Solving
7/28/2019 2012 New Orleans Health 13
2/36
1 May 30, 2012 [Enter presentation title in footer] Copyright 2007
13L Best Practices for Excel
Design and ControlsPeer Review and Quality Control
Presented by
Hans Leida, PhD, FSA, MAAA
Actuary
J une 13, 2012
So youve built a model(well-documented and organized, of course)
Is it error-free?
Checking: does it do what you intended it to do
Is it correct?
Peer review: does it do what itshould do
Are you aiming at the right target?
Will it remain error-free and correct over time?
2 J une 13, 2012
7/28/2019 2012 New Orleans Health 13
3/36
2 May 30, 2012 [Enter presentation title in footer] Copyright 2007
Agenda
Checking and Peer review
Version control and Archiving
Excel 2010 Some relevant highlights
3 J une 13, 2012
Checking and Peer Review
Checking: detailed, technical review of a spreadsheet (or other
analysis)
Peer review: higher level review of an analysis and its results
Both should be performed by analysts or actuaries other than
the author(s) of the model
Allow enough time for the process and get the right reviewers
Best practice agree to standards regarding:
4 J une 13, 2012
Documentation of reviews including sign-off; and
Periodic audits to make sure reviews are happening.
7/28/2019 2012 New Orleans Health 13
4/36
3 May 30, 2012 [Enter presentation title in footer] Copyright 2007
Poll:
What percentage of finished spreadsheets
contain errors causing wrong results?
A. 25%
B. 50%
C. 75%
D. 85%
E. 95%
5 J une 13, 2012
Poll:What percentage of finished spreadsheets
contain errors causing wrong results?
A. 25%
B. 50%
C. 75%
D. 85%
E. 95%
we found that 7 of the 50spreadsheet workbooks we
audited were error free, for a
spreadsheet error rate of 86%.Powell et. al. (2009)
http://mba.tuck.dartmouth.edu/spreadsheet/product_pubs_files/Errors.pdf
6 J une 13, 2012
7/28/2019 2012 New Orleans Health 13
5/36
4 May 30, 2012 [Enter presentation title in footer] Copyright 2007
Poll:
Does your employer have an explici t policy
regarding spreadsheet checking and review?
A. What happens in Vegas stays in Vegas.
B. We do reviews, but the process is informal.
C. Yes, but its understood that getting things done on time
is more important.
D. Yes, and we audit compliance on a regular basis.
7 J une 13, 2012
E. I am reviewing a spreadsheet right now.
Poll:Does your employer have an explici t policy
regarding spreadsheet checking and review?
A. What happens in Vegas stays in Vegas.
B. We do reviews, but the process is informal.
C. Yes, but its understood that getting things done on time is
more important.
D. Yes, and we audit compliance on a regular basis.
8 J une 13, 2012
E. I am reviewing a spreadsheet right now.
7/28/2019 2012 New Orleans Health 13
6/36
5 May 30, 2012 [Enter presentation title in footer] Copyright 2007
Checking Approaches
Review every cell and every line of VBA
Review a sample of cells and VBA code, random or nonrandom
Recreate results using a different method
Go beyond mechanical reviews
Are the inputs up to date and from the correct source?
Does the output make sense?
Can you estimate ballpark ranges that are reasonable?
9 J une 13, 2012
,
lost along the way?
Balance rigor of review process with materiality of analysis
Design Spreadsheets to be Easy to Check
Documentation and organization
Use formatting to your advantage
Break complex formulas down into simple pieces
Use macros or data tables instead of manual copy/paste
Avoid links
Data validation on inputs
Cell protection to prevent accidental overwriting of formulas
10 J une 13, 2012
7/28/2019 2012 New Orleans Health 13
7/36
6 May 30, 2012 [Enter presentation title in footer] Copyright 2007
Data Validation and Integrity
Include checks and cross validations as part of spreadsheet;
gather them into a master validation sheet
Need to distinguish floating point rounding differences from true
discrepancies
Check input data for invalid, extreme, or null values
Control totals at each step of the way
11 J une 13, 2012
Checking Tips and Tricks
Use array formulas to compare ranges all at once:
{=AND(Analysis!A1:C1000 =Data!B1:D1000)}
Use formula tracing in Excel (third party tools also available)
Purchase or create tools to validate copies of a model versus a
master copy
For complex formulas/concepts, do a hand calculation
12 J une 13, 2012
7/28/2019 2012 New Orleans Health 13
8/36
7 May 30, 2012 [Enter presentation title in footer] Copyright 2007
Peer Review
Often efficient to separate higher level review from technical
checking
Reviewer focuses on big picture and spot checks assumptions,
values, and calculations
Also considers risks and whether results are communicated
appropriately (ASOP compliance, appropriate caveats)
Sanity checks
Talk throu h ro oseda roachand assum tions with eer
13 J une 13, 2012
reviewer prior to implementation
Changes that are made as a result of checking or peerreview must also be checked and peer reviewed before
sign-off.
Agenda
Checking and Peer review
Version cont rol and Archiving
Excel 2010 Some relevant highlights
14 J une 13, 2012
7/28/2019 2012 New Orleans Health 13
9/36
8 May 30, 2012 [Enter presentation title in footer] Copyright 2007
Version Control and Archiving
Use a change log within the
spreadsheet to log all changes
Keep read-only archives of all
versions that have been relied upon
for actuarial communications
Talk to your legal counsel about
document retention policies
Learn about how often backups are
15 J une 13, 2012
made, and how long they are retained
You are saving your work on a server,
not your C: drive, right?
Agenda
Checking and Peer review
Version control and Backups
Excel 2010 Some relevant highlights
16 J une 13, 2012
7/28/2019 2012 New Orleans Health 13
10/36
9 May 30, 2012 [Enter presentation title in footer] Copyright 2007
Excel 2010 Highlights(and some from 2007)
More robust change tracking and review
Who, When, Where filtering
List of changes can be exported to a new sheet
PowerPivotcan replace lookups with table joins
DAX (data analysis expressions)
Tables (new in Excel 2007, enhanced in 2010)
Group and filter related data and formulas
Automatically expand formulas down when data expands
17 J une 13, 2012
Use structured references instead of cell references
Enhanced conditional formatting Gradient fills, in-cell bar charts, sparklines
Thanks!
Hans Leida, PhD, FSA, MAAA
Actuary
952.820.2410
7/28/2019 2012 New Orleans Health 13
11/36
5/30/20
Actuarial
Excel design and
controls
Society of actuaries Health meeting
J une 13 15, 2012
Agenda
Why are Excel controls needed?
Standard starting place
Documentation
Conclusion
2012 KPMG LLP, a Delaware limited liabilitypartnership and the U.S. member firmof the KP MG network of independentmember firms affiliated with KPMG International Cooperative (KPMG International), a Swiss entity. All rights reserved.29145DEN
1
7/28/2019 2012 New Orleans Health 13
12/36
5/30/20
Why are Excel controls
needed?
Why?
Professional Standards
Avoiding errors
Risk Management
Effectiveness and efficiency of operations
Compliance with Regulatory Requirements
Sarbanes-Oxley (SOX)
Demonstrate internal controls by:
Maintaining calculations
Supporting/Documenting all adjustments
2012 KPMG LLP, a Delaware limited liabilitypartnership and the U.S. member firmof the KP MG network of independentmember firms affiliated with KPMG International Cooperative (KPMG International), a Swiss entity. All rights reserved.29145DEN
3
Recording management approvals and sign off
7/28/2019 2012 New Orleans Health 13
13/36
5/30/20
Why? (continued)
Model Audit Rule (MAR)
Show external auditors (at the Statutory level):
How controls work, are monitored and are documented
Produce an analysis of the level of risk associated with each control
Solvency II Use Test
Show internal models are integrated into the risk management process whendetermining required capital
Demonstrate management both understands and uses the models
Own Risk and Solvency Assessment (ORSA)
2012 KPMG LLP, a Delaware limited liabilitypartnership and the U.S. member firmof the KP MG network of independentmember firms affiliated with KPMG International Cooperative (KPMG International), a Swiss entity. All rights reserved.29145DEN
4
Group wide assessment showing current capital needs are appropriate and futureneeds will be met
Forward looking analysis using risk based projection models where all the assumptions,interdependencies, and risk levels are documented and confirmed by management
Polling question 1
What percentage of your workday is spent in Excel?
A. 0% 25%
B. 25% 50%
C. 50% 75%
D. 75% 100%
2012 KPMG LLP, a Delaware limited liabilitypartnership and the U.S. member firmof the KP MG network of independentmember firms affiliated with KPMG International Cooperative (KPMG International), a Swiss entity. All rights reserved.29145DEN
5
7/28/2019 2012 New Orleans Health 13
14/36
5/30/20
Standard starting
Standard starting place
Create a Standard Set of workbooks for valuation and modeling
Clean starting point for each month, quarter and year end.
Agreed upon by the whole team
Consistent appearance/structure within the workbooks
Document any improvements to the standard set
No hard coded cells moving from month to month
No holdover formula adjustments
2012 KPMG LLP, a Delaware limited liabilitypartnership and the U.S. member firmof the KP MG network of independentmember firms affiliated with KPMG International Cooperative (KPMG International), a Swiss entity. All rights reserved.29145DEN
7
7/28/2019 2012 New Orleans Health 13
15/36
5/30/20
Documentation
Polling question 2
I feel comfortable our current level of documentation is sufficient to meet current and soon tobe enacted regulatory requirements.
A. Strongly Agree
.
C. Neutral
D. Disagree
E. Strongly Disagree
2012 KPMG LLP, a Delaware limited liabilitypartnership and the U.S. member firmof the KP MG network of independentmember firms affiliated with KPMG International Cooperative (KPMG International), a Swiss entity. All rights reserved.29145DEN
9
7/28/2019 2012 New Orleans Health 13
16/36
5/30/20
Documentation
Create Documentation Tab
Contained within the workbook defining:
Contact person for questions about the workbook
What workbook does,
Instructions for use,
Define all macros,
Where input data comes from,
Where output data goes,
Methodology used,
2012 KPMG LLP, a Delaware limited liabilitypartnership and the U.S. member firmof the KP MG network of independentmember firms affiliated with KPMG International Cooperative (KPMG International), a Swiss entity. All rights reserved.29145DEN
10
Date of analysis,
Intended use for results
Documentation (continued)
Structure of Inputs
Label the inputs and which values within the workbook must be updated
Create a Checklist of the inputs containing
Input Data description
The input source (a file, or location of support if the input is a value)
The date the input was updated
Avoid quick side calculations and hard coded numbers without source support
2012 KPMG LLP, a Delaware limited liabilitypartnership and the U.S. member firmof the KP MG network of independentmember firms affiliated with KPMG International Cooperative (KPMG International), a Swiss entity. All rights reserved.29145DEN
11
7/28/2019 2012 New Orleans Health 13
17/36
5/30/20
Documentation (continued)
Descriptive names
Label tabs by the function within the tab Input data, Trend Analysis, Summary
Column Headings should be clear and useful
Include Dates in the naming and labeling
Use Named ranges for sets of cells and groups of data
Label tables and charts with clear titles and descriptions of what is representedin the analysis
2012 KPMG LLP, a Delaware limited liabilitypartnership and the U.S. member firmof the KP MG network of independentmember firms affiliated with KPMG International Cooperative (KPMG International), a Swiss entity. All rights reserved.29145DEN
12
Documentation (continued)
Formatting
Use text colors and cell colors
User inputs are blue, one time adjustments are red, changes in the formulas or method
Set up a uniform definition for the colors or if a new color is used remember to labelwhat that color change means
Color Code tabs
Match the tab colors according to function (data, analysis and summaries) orpresentation sets (management, SOX required tabs, internal and external audit)
Format numbers
2012 KPMG LLP, a Delaware limited liabilitypartnership and the U.S. member firmof the KP MG network of independentmember firms affiliated with KPMG International Cooperative (KPMG International), a Swiss entity. All rights reserved.29145DEN
13
Use commas and dollar signs so it is easy to understand
7/28/2019 2012 New Orleans Health 13
18/36
5/30/20
Documentation (continued)
Assumption Decisions
Sufficient documentation to support the assumptions chosen
Links to Experience Studies
Description cells that point to the memos describing the decision
Check for consistent coding of assumptions within the models
Define relationships and interdependencies of the assumptions include ariskassessment
Create a formal review and approval process
Using links to signed memos and electronic signatures
2012 KPMG LLP, a Delaware limited liabilitypartnership and the U.S. member firmof the KP MG network of independentmember firms affiliated with KPMG International Cooperative (KPMG International), a Swiss entity. All rights reserved.29145DEN
14
Documentation (continued)
Segregation of Duties
Establish approval process over
Testing any new assumptions or methods from reviewing
Reviewing data inputs
Updating the workbook/model, reviewing any changes
Reviewing workbook/model outputs
Separate the responsibilities of the execution of the change from the reviewingof the change
Record the separation using dates, signatures, links to approval emails or memos
2012 KPMG LLP, a Delaware limited liabilitypartnership and the U.S. member firmof the KP MG network of independentmember firms affiliated with KPMG International Cooperative (KPMG International), a Swiss entity. All rights reserved.29145DEN
15
7/28/2019 2012 New Orleans Health 13
19/36
5/30/20
Documentation (continued)
Create a Log tab
Encourages more secure version control
Makes review process standard part of work process
Log should contain the date, user name, task performed, indicator for management review
Fill out every time the workbook is opened, updated, reviewed
Document changes with details of support for the change
Document those changes and decisions were reviewed
Document sign offs within the workbook itself and always include the date!
2012 KPMG LLP, a Delaware limited liabilitypartnership and the U.S. member firmof the KP MG network of independentmember firms affiliated with KPMG International Cooperative (KPMG International), a Swiss entity. All rights reserved.29145DEN
16
Thank you.
7/28/2019 2012 New Orleans Health 13
20/36
5/30/20
Contact details
Ali sa Widmer
Senior Associate
Health Insurance Segment
Actuarial Services
www.kpmg.com
2012 KPMG LLP, a Delaware limited liabilitypartnership and the U.S. member firmof the KP MG network of independentmember firms affiliated with KPMG International Cooperative (KPMG International), a Swiss entity. All rights reserved.29145DEN
18
The information contained herein is of a general nature and is not intended to address thecircumstances of any particular individual or entity. Although we endeavor to provide accurateand timely information, there can be no guarantee that such information is accurate as of the
date it is received or that it will continue to be accurate in the future. No one should act onsuc n orma on w ou appropra e pro ess ona a vce a er a oroug examna on o eparticular situation.
2012 KP MG LLP, a Delaware limited liability partnership and the U.S. member firm of theKPMG network of independent member firms affiliated with KPMG International Cooperative(KPMG International), a Swiss entity. All rights reserved. 29145DEN
The KPMG name, logo and cutting through complexity are registered trademarks ortrademarks of KPMG International.
7/28/2019 2012 New Orleans Health 13
21/36
5/30/20
13L Best Practices for ExcelDesign and Controls
Presenter: Steven F. Wright, FSA
Ruark Consulting LLC
7/28/2019 2012 New Orleans Health 13
22/36
5/30/20
VBA Demonstration
VBA Demonstration
7/28/2019 2012 New Orleans Health 13
23/36
5/30/20
VBA Demonstration
Best Practices for using VBAin Excel
What the focus will be on:
rganza on
Functionality
Good habits
What the focus will not be on:
Performance
Kevin Ropers SOA article: Excel VBA Speed andEfficiency
7/28/2019 2012 New Orleans Health 13
24/36
5/30/20
Poll: Experience with VBA
What is your experience with Excel VBA?
A: Whats VBA?
B: None I have others do my dirty work.
C: Use VBA a little, but mostly just fromrecorded macros
D: I create my own VBA methods
E: I probably know more than you, Steve
Definitions
VBA Visual Basic for Applications
Method a subroutine or a function
Module a group of methods
7/28/2019 2012 New Orleans Health 13
25/36
5/30/20
First Thing First:
PlanPlan
Output
Future needs
Players
Input
Agree on Scope
oBe specific; in writing
Outline the Process
Recycle
Think to reuse code
o I will show an example later
Store in Utility modules
oGeneral: Utilities_5_21_12
o pec c: es_ eservng
7/28/2019 2012 New Orleans Health 13
26/36
5/30/20
Poll: Proper variable name
Which is the best name for a variable tos ore e pan co e ex
A: plan
B: strPlanCode
C: planCode
D: PlanCode
E: plan_Code_And_Year
Decide on a Naming ConventionVariables
7/28/2019 2012 New Orleans Health 13
27/36
5/30/20
Decide on a Naming ConventionVariables
Two main schools of thought:
1.Type as prefix: strPlanCode
2. Camel style: planCode
Dont abbreviate
Key is: Be consistent
Poll: Proper variable name
Which is the best name for a variable tos ore e pan co e ex
A: plan
B: strPlanCode
C: planCode
X notdescriptiveenough
D: PlanCode E: plan_Code_And_YearX lookslikeamethodname
toolong
7/28/2019 2012 New Orleans Health 13
28/36
5/30/20
Decide on a Naming ConventionMethods
Capitalize first word and every word
Dont abbreviate
Start with verb
Good examples:
oGetPlanCode
o r e a ues
o
Set_Credited_Rateo InitializeVariables
Decide on a Naming ConventionMethods
Capitalize first word and every word
Dont abbreviate
Start with verb
Good examples:
oGetPlanCode
o r e a uesoSet_Credited_Rate
o InitializeVariables
7/28/2019 2012 New Orleans Health 13
29/36
5/30/20
Decide on a Naming ConventionMethods
Capitalize first word and every word
Dont abbreviate
Start with verb
Good examples:
oGetPlanCode Function
o r e a ues
o
Set_Credited_Rateo InitializeVariables
Subroutines
Be Flexible
Everything is a variable [ no hardcoding ]
Examples:
mode = 4
planName = Ultimate12
numScenarios = 2000
Ask: Can this ever change? How?
7/28/2019 2012 New Orleans Health 13
30/36
5/30/20
Readable Code
Readable Code
Controlling method
Group methods in modules
Dim global variables in onespot (Initialize module)
Limit each line
omment Indent & Spaces
7/28/2019 2012 New Orleans Health 13
31/36
5/30/20
Readable Code Example
Public Function GetRangeNames(ByVal strFind As String) As String()
Const delimiter As String =","
Dim iNameAs Integer
Dim rangeNameAs String, rangeNames As String
On Error GoTo ErrorHandler
Public Function GetRangeNames(ByVal strFind As String) As String()
' This function returns an array of all range names found that include strFind
Const delimiter As String =","
Dim iNameAs Integer
For iName=1 To ActiveWorkbook.Names.count
rangeName=Names.Item(iName).Name
If InStr(rangeName, strFind) Then
rangeNames= rangeNames& rangeName& delimiter
End If
Next iName
If rangeNames"" Then _
rangeNames= Left(rangeNames, Len(rangeNames) - Len(delimiter))
GetRangeNames =MakeStringArray(rangeNames, delimiter) ' in Utilities module
CleanUpAndExit:
Exit Function
ErrorHandler:
MsgBox "Error in GetRangeNames:" & vbCrLf & _
Err.Number& " " & Err.Description
Resume CleanUpAndExit
End Function
Dim rangeName As String, rangeNames As String
On Error GoTo ErrorHandler
' Loop on range names in workbook to see if it includes strFind
For iName=1 To ActiveWorkbook.Names.count
rangeName= Names.Item(iName).Name
If InStr(rangeName, strFind) Then
' this range is a match, so add to string of range names
rangeNames=rangeNames & rangeName& delimiter
End If
Next iName
' take off las t delimiter
If rangeNames "" Then _
rangeNames=Left(rangeNames, Len(rangeNames) -Len(delimiter))
GetRangeNames =MakeStringArray(rangeNames, delimiter) ' in Utilities module
CleanUpAndExit:
Exit Function
ErrorHandler:
MsgBox "Error in GetRangeNames:" & vbCrLf & _
Err.Number& " " & Err.Description
Resume CleanUpAndExit
End Function
Catch Errors
7/28/2019 2012 New Orleans Health 13
32/36
5/30/20
Catch Errors
Error Handling section
oAnticipate common errors
oGeneric capture of others
oSend meaningful messages
Error Handling example
Public Function GetPlanIndex (byval fileName as String) as Integer
CleanUpAndExit:
Exit Function
ErrorHandler:
GetPlanIndex=-1
Select Case Err.Number
Case 53
msgboxThe file & fileName& does not exist
Signaltouser:BAD
Expectedpossibleerror
Case ElsemsgboxError in GetPlanIndex: & vbcrlf& _
Err.Number & & Err.Description
End Select
Resume CleanUpAndExit
End Function
CatchAll
7/28/2019 2012 New Orleans Health 13
33/36
5/30/20
Cleanup after yourself
Dispose of Objects
oObject: use Set
oClose it: [var].Close
oDelete it: Set [var] = Nothing
Prune the dead greenery
Exit a method in only one spot
Test Test Test
You try to break it
Have users try to break it
You try to break it again
7/28/2019 2012 New Orleans Health 13
34/36
5/30/20
And now the dreaded part:Documentation
Documentation
Written documentation
Review comments in methods
Psst: Want to make your life easier?
7/28/2019 2012 New Orleans Health 13
35/36
5/30/20
Final Thoughts
Store all workbook variables on one sheetore ara es .
Option Explicit first line of code
oAvoids incorrect typing
Meaningful looping variables
oEx: iSheet instead of just i to loop on sheets
Summary
1. Plan 5. Flexible
2. Readable
3. Recycle
4. Consistentnaming
6. Catcherrors7. Cleanup
8. Test
9. Document
7/28/2019 2012 New Orleans Health 13
36/36
5/30/20
13L Best Practices for ExcelDesign and Controls
Presenter: Steven F. Wright, FSA
Ruark Consulting LLC