Recently, we discussed about the case of unwieldy data and how we lookup what we want using formulas like SUMIFS. Today, let us learn few more ways to solve the same problem.
First, a re-cap of the problem:
Here is a data-set:

The problem – build a lookup formula
And the problem. Oh, simple. Write a lookup formula to find how many customer walk-ins we have on any given day.
In the previous article, we discussed how to use SUMIFS to solve this problem. There were several amazing & awesome solutions shared by our readers in the comments section too.
Suitable structure spawns simple solutions
Poorly structured is the 2nd biggest problem of analysts. The first one is not enough coffee. That is why there is a dictum in the data analytics world.
Structure is everything
So, we can easily solve our lookup problem, if our data were to magically re-arranged in 2 column fashion – Data & Value.

This transformation can be done in 2 ways:
Option #1: Transforming Data – Using Formulas
We can use data fetching formulas like OFFSET or INDEX to re-arrange data in 2 columns.
Assuming,
- Our 2D data is in a named range data,
- There are running numbers starting with 0 in the cell J5
We can use below formula to fetch first column:
=IFERROR(INDEX(data,2*(INT(J5/7))+1,MOD(J5,7)+1),"")
for the second column, below formula works:
=IFERROR(INDEX(data,2*(INT(J5/7)+1),MOD(J5,7)+1),"")
How does this formula work?
I will explain the formula for first column. Deciphering 2nd column formula is your homework.
Here is the formula again: =IFERROR(INDEX(data,2*(INT(J5/7))+1,MOD(J5,7)+1),"")
Before understanding the formula, let’s take a minute to examine the structure of our raw data.
- Odd rows contain dates
- Even rows contain values
- There are 7 columns in total
- So to get the first date, we need to go to row 1 (first odd number), column 1
- To get the first value, we need to go to row 2 (first even number), column 1
- But to get 8th date, we need to go to row 3(2nd odd number), column 1
- So on
Let’s go from inside out.
2*(INT(J5/7))+1portion: This gives row number (ie odd number). J5 refers to running number and its value is 0. So we get 2*(INT(0/7))+1 = 1- This will be 3 when J5 becomes J12 (ie 8th date)
MOD(J5,7)+1portion: This gives column number. It will result in values 1 thru 7 in a cyclical fashion. Thanks to MOD.INDEX(data, ..., ...)portion: Now that we have both row & column numbers, INDEX formula kicks in and gets the corresponding date.IFERROR(INDEX(...),"")portion: This is to help in case we ran out of all dates & values in our INDEX formula. Read about IFERROR here.
Once you have the formulas for first date & value, simply drag them to get rest of the values.
Option #2: Transforming data – Using VBA
VBA Macros are perfect for scenarios like this. Usually transformation is something you need to do every-time you import data from external systems. So simply write a macro that can do this automatically.
Assuming our data is in the range data and the first cell of our extraction range is startHere, you can use below macro:
Sub rearrangeData()
'takes the values in DATA named range and rearranges them
'from the named cell startHere
Dim cell As Range, i As Long, j As Long, evenRow As Boolean, firstRow As Long
i = 0
j = 0
firstRow = Range("data").Cells(1).Row
For Each cell In Range("data")
evenRow = (cell.Row - firstRow + 1) Mod 2 = 0
If evenRow Then
Range("startHere").Offset(j, 1).Value = cell.Value
j = j + 1
Else
Range("startHere").Offset(i, 0).Value = cell.Value
i = i + 1
End If
Next cell
End Sub
How does this macro work?
Before jumping in to the lines of code and demystifying the logic, Let’s understand what we need to do:
- For each cell of data,
- If it is in odd row, put the cell data in Date column at end
- Else, put the cell data in Value column at end
- Repeat
This is what our code is trying to do.
Let’s examine the For Each loop, as this is the most critical part of our macro.
- For each cell in the range data
- We check if we are in evenRow using simple arithmetic on row numbers
- If we are in evenRow then
- We put the cell value in row j (number of values so far), column 2
- We increment j
- Else
- We put the cell value in row i (number of dates so far), column 1
- We increment i
- Close the IF condition
- We check for next cell in the data range
Advantages of Transformation over SUMIFS approach
Both options for transforming data have few advantages:
- They work with any type of data (unlike SUMIFS, which works only for numeric lookups and has few other issues)
- Once data is restructured, you can do other types of analysis like creating pivot tables, adding extra calculated columns etc. easily.
Download Example Workbook
Click here to download example workbook that shows original SUMIFS solution, both options for transforming data & few other formulas. Play with it to learn more. Check out the code by pressing ALT+F11.
How would you transform data?
My favorite techniques for transforming data are – VBA, formulas, Power Query, pivot tables & SQL. Depending on the situation, time availability, where my data is, I choose one of these options to scrub my data.
What about you? How do you clean up / scrub data like this? Please share you thoughts & tips with us in comments.
Instructions for washing your dirty data
If your work involves scrubbing dirty data, check out below tutorials too:
- Extract numbers from text using VBA and formulas
- Filling blank cells with above values in tables
- Cleaning up in-correctly formatted dates
- Fixing in-correctly formatted phone numbers
- Reverse a list using INDEX formula
- Transpose a table using formulas

















18 Responses to “Best Charts to Compare Actual Values with Targets – What is your take?”
Great post. I can't vote, though, because the answer I want to put down is "it depends". As with all visualisations, you've got to take into account your audience, your purpose, technical skills, where it will be viewed, etc.
I'm with Andy: It depends. Some I would use, some I might use, some I won't touch with a barge pole.
Naturally I have comments 🙂
The dial gauge, though familiar, is less easy to read than a linear type of chart (thermometer or bullet). It's really no better than the traffic lights, because all it can really tell you is which category the point falls in: red, yellow, or green.
By the same token, pie charts are so familiar, people don't know they can't read them. Remember how long it takes kids to learn to read an analog clock?
Bullet charts don't show trends.
With any of the charts that have a filled component and a marker or ine component, it makes more sense to use the filled component (area/ column) for target, and the lines or markers for actual.
[...] Best Charts to Compare Actual values with Targets (or Budgets … [...]
I voted for #6 even though I agree with the other comments that it depends.
The majority of the votes are for the #2, thermometer chart. I still have yet to understand what happens when you are above plan/goal, which was brought up in yesterday's post.
Also, I agree with Jon in that it would be better to flip the series and make the filled part the target or goal and the line or marker the actual.
I am also a fan of using text when appropriate if the data is among other metrics in a type of dashboard. Calling it out by saying actual and % achievement is a good option.
Another "it depends" vote. Are you just looking at one or are you comparing a number of targets with actuals? You didn't include a text box. The problem with sentences is that they can get lost in a page of gray text. A text box can call attention to the numbers and line them up effectively.
I'm with Jon: "Some I would use, some I might use, some I won’t touch with a barge pole" and I'm surprised that some of your readers voted for the last group.
Jon says:
With any of the charts that have a filled component and a marker or line component, it makes more sense to use the filled component (area/ column) for target, and the lines or markers for actual.
Why does this make more sense? I like 6 the way it is, although I would use a heavy dash for the plan/target marker.
"It depends" is also my take. What I usually try to drill into my clients dashboard design is the fu ndamental difference between spot results (am I on target for this month) and long term trends.. I always try to create 3 different set of graphs to represent real perormance:
- spot results vs objectives
- cumulative results vs objectives
- long-term trend (moving average) mostly) to see where we're going
[...] Best Charts to Compare Actual Values with Targets – What is your take? (tags: excel charts) [...]
[...] Related: Charting Principles, How to compare actual values with budgets [...]
[...] Excel Charting Alternatives to compare values [...]
Jon says:
With any of the charts that have a filled component and a marker or line component, it makes more sense to use the filled component (area/ column) for target, and the lines or markers for actual.
Why does this make more sense? I like 6 the way it is, although I would use a heavy dash for the plan/target marker.
I totally agree, Bob. I would normally favour a line for the target and a column for the actual, you can see quite easily then which columns break through the line, then.
[...] best charts to compare actual values with targets — den Status mal anders zeigen, z. B. als Tacho [...]
Thermometer charts: "Not appropriate when actual values exceed targets" - this is easily solved by making the "mercury" portion a different color from the border, then you can clearly see where the expected range ends and the actual values keep going.
People seem to knock gauges quite a bit in dashboarding, but trying to show comparison of realtime data between operating sites and targets for each site can easily be done with a bank of gauges that have the optimal operating points at 12 o'clock.
The human eye is great at pattern stripping, and any deviation of a gauge from the expected 12 position will quickly register with an operator and attract his attention. Using a colour background, or meter edge, will also indicate the sensitivity of a particular site.
[…] Best charts to compare actual with target values […]
[…] Best charts to compare actual with target values […]
[…] work laptop I have a favorites folder just dedicated to Excel charts. Its got things like “Best Charts to Compare Actuals vs Targets” and “Best charts to show progress“. I love me some charts […]
I am wondering how will the plotting work, for some of the targets which may have been achieved before time. E.g. for the month of Jul the target was 226 and the actual was 219. So the chart will show a deficit in meeting the target by 7 points but what if this 7 may have been completed earlier in month of June. So ideally it not a deficit.