This is a guest post by Vijay, our in-house VBA Expert.
Hello Everyone,
We all have some projects to manage every now and then and there are needs of various trackers that help us in gauging the progress of the same. One of the most important things are heat maps that quickly help us in visually displaying the names of the projects that need special attention and resolve issues that are impacting them.
So go ahead and grab a cup of coffee and read this article that would help you in creating a Risk Heat Map in excel (will use some double shot espresso in the form of VBA code) to help us to the target.
Before we begin
First of all we will understand what we are trying to create here by looking at the image below.You would have seen a picture like this while managing project risks.
So today we will be learn how to create this in Excel to become more awesome in managing projects.
What is important here is how your data for the projects/entities being tracked laid out. We will use the Excel data tables [structured references] to help us here.
There is a Setup sheet in the excel file where we can add the names of the projects that we will use on the data table, as well as the Probability and Impact have been defined as data tables. This helps us in using their contents as drop down options in the data table.
Adding Named Ranges
We need to use the Name Manager to create named ranges to be able to use the data table columns as drop down items, this is show below.- 1.Type this in a blank cell and then copy “=tblProject[Project]”.
- 2.Bring up the Name Manager by pressing CTRL + F3, or by going to the Formula’s Tab and clicking on Name Manager.
- 3.Click on New
- 4.Type the name lstProject in the Name box
- 5.Paste “=tblProject[Project]” in the Refers To box and the click on OK.
Now you can go the actual risk data table and select the Project columns first blank cell and put in Data Validation List here, choose List and put the Source as lstProject. Repeat this for Probability and Impact cells. You will only need to this one time for the first row, new rows when added to the table will automatically contain these settings.
After we have created the above data table, we need to add 3 columns to the right side where we will setup the calculation that will be used to update the risk map.
a) First Column is named as “ProbabilityScore” Since probability has been marked as “A, B, C or D”, we would need to convert this into a number. This is done by using the below formula.
=IFERROR(CHOOSE(MATCH([@Probability],lstProbability,0),4,3,2,1),”")
b) Second Column is named as “SearchString”
=IF([@Status]=”Open”,CONCATENATE(“x”,[@ProbabilityScore]^4+[@Impact]),”")
c) Third column is named as “DisplayName”
=CONCATENATE([@ID],” “,LEFT([@Project],20),IF(LEN([@Project])>20,”…”,”"))
Understanding the SearchString Table
When creating the SearchString we are raising the probability score to the power of 4, this is what I have chosen you may select any number that you need. Below is the resulting matrix of numbers that we obtain by doing this.The last columns in only used for trimming the name of the project to 20 characters of there is a big name, else the actual name of the project is used to display in the Risk Map.
Understanding the Code
So now we are ready to look into the VBA code that helps us in creating the Risk Map.
Public Function showRiskMap(inputRange As Range, searchString As String, dataRange As Range, separator As String)
Dim cntr As Long
Dim tempArray() As Variant
Dim tempDataArray() As Variant
Dim tempString As String
tempArray = inputRange.Value
tempDataArray = dataRange.Value
For cntr = LBound(tempArray) To UBound(tempArray)
If tempArray(cntr, 1) = searchString Then
tempString = tempString & tempDataArray(cntr, 1) & separator
End If
Next
showRiskMap = tempString
End Function
We are sending 4 parameters to this function which are
- inputRange – this is the SearchString columns data
- SearchString – this is a manual enrty such as “x257”
- dataRange – this is the Display Name column from where we will pick the name of the project to display
- separator – this is CHAR(10) which is a line break in case we have multiple projects falling in the same category
I hope you will enjoy this article and this assist in managing your projects in a much efficient way.
Download Excel Risk Map File
Click here to download the file & use it to understand this technique.Do you use Excel for creating Risk Maps?
Do you also user Excel for creating Risk Maps? If yes please put in the comment below how do you use the same and what has been your experience. Leave a comment.More on VBA & Macros
If you are new to VBA, Excel macros, go thru these links to learn more.Join our VBA Classes
If you want to learn how to develop applications like these and more, please consider joining our VBA Classes. It is a step-by-step program designed to teach you all concepts of VBA so that you can automate & simplify your work.Click here to learn more about VBA Classes & join us.