Combine Tables and Charts on Excel Dashboards

Visualize Football League statistics on an Excel Dashboard integrating charts directly into a table

Allianz Arena - Home of FC Bayern Munich - click to enlarge Combining tables and charts is a very powerful technique for creating Microsoft Excel dashboards. It allows you to integrate texts, values and visualizations into one table. This ensures to have the maximum of information at a glance, including a direct comparability row by row.

I already used this technique in several posts before, like the Sparklines for XL showcase or the Software Project Dashboard examples. Today’s article provides another showcase for a dashboard combining tables and charts.

Football rules the world, especially these days. We are all impatiently waiting for the FIFA World Cup in South Africa, aren’t we? My friend Chandoo recently had a very nice post on visualizing the different footballs used in the World Championships since 1930. That’s remarkable, because Chandoo lives in India and I suppose he is more interested in cricket than football. But as I said, football rules the world these days.

That’s why it somehow suggests itself to use a football-related visualization for today’s post. But I will not go for the FIFA World Cups. Not yet. Today’s article shows how to visualize national football league statistics using a dashboard that combines tables and charts. As always including the Microsoft Excel workbook for free download.

The show case

The idea of this show case is as simple as can be. Let’s assume we have all results of all seasons of a national football league in one Excel table, i.e. the season, the match day, the home team, the away team, the goals of the home team and the goals of the away team:

Raw Data Table - click to enlargeThe challenge is to automatically transfer this raw data into an interactive dashboard showing the actual table for any given match day in any given season, including an overview of the results of the selected match day, further statistics on the match day and some sort options:  

Dashboard Table - click to enlargeThe structure of the workbook

The workbook contains 6 worksheets:

  • Dashboard

The display: the name is self-explanatory, isn’t it? This worksheet displays the dashboard as shown in the screenshot above

  • Results

The raw data: all match results of several seasons (1996/97 till 2009/10 in our example) for one or several football leagues (German 1. and 2. Bundesliga in our example)

  • Calculation Table

The heart of the workbook: this is where the action is. The worksheet contains all data consolidation, the sorting algorithm, the set-up of the charts, the match day and overall statistics, etc.

  • Calculation Results

The data snapshot: this worksheet provides the relevant snapshot of the raw data, i.e. the results of the season and the league selected by the user

  • Calculation Positions

The history: this worksheet contains a data table with all positions of all teams during the whole season. The table is not calculated by using formulas, but rather created by a simple VBA routine

  • Control

The interactivity control: the worksheet stores the selection lists and the target cells for the interactive form controls on the dashboard

As already explained here, this reflects the structure of all my Excel models: the data, the calculations and the display on separate worksheets.

The techniques

Creating a football league table, additional visualizations and more statistics from the raw results requires some more complex functions and operations like OFFSET, INDEX, MATCH, LARGE, SMALL, array formulas and others. Furthermore a little trick is needed to implement the formula based sorting algorithm. Detailed information on the used functions can easily be found on other websites and blogs and the sorting technique is already described here. Thus, I will not go into the details of the calculations. I am rather limiting myself to the following two other techniques used in the workbook:

Technique 1 – combine tables and charts on a dashboard

The idea of integrating charts into a table is obvious. The steps to prepare your dashboards are simple:

  • Create a table on the dashboard
  • Increase the height of the rows. Usually 35 points are enough
  • Insert columns where you want to add your visualizations
  • Increase the widths of these columns to e.g. 15 to 30 points
  • Insert either one chart covering all rows in your table (bar charts or stacked bar charts) or one chart per cell (column charts or line charts)

Especially for the latter, I recommend using sparklines like Fabrice’s Sparklines for XL or Excel’s built-in sparklines (if you are already using Microsoft Excel 2010). If, for whatever reason, you do not want to use sparklines, you can create the charts using standard Excel as well. However, especially the set-up of the charts, the resizing, the positioning and the formatting is laborious work. You have to remove everything from the charts besides the visualization itself, i.e. the gridlines, the caption, the data values, the fill color of the plot area, etc. Sometimes you have to set the scaling of the axes as well.

As I said: laborious work. Here are two tips which might save you some time:

  1. The ALT-key

    Holding the ALT-key pressed during resizing and positioning a chart will make the edges of the chart snap to the cell grid of the Excel workbook. This helps aligning the charts. In Excel 2007 and later, this trick does not only work for the chart object itself, but also for the plot area
     

  2. Copy the chart and change the data source

    If you have to create several charts (e.g. the column charts or line charts in our example), I recommend creating one chart first and doing all the formatting, axes scaling and resizing for this master. Then copy the master, change the data source of the copy and position it to the right place on your dashboard. Usually this technique is much faster than doing all the formatting again. Another option would be to create all charts, format the first one, select and copy it and paste special formats to the other ones. However, this does not transfer e.g. changes in the axes scaling to the other charts. Thus, I recommend creating a master and simply copy the chart, position the copy and change the data source. From my point of view this is much faster.

Technique 2 – use the workbook calculation and VBA for creating a history table

The basic calculation of the table is based on consolidating the results for one selected match day. However, for visualizing the team trends on the line charts, we need the positions of all teams during the last 10 match days. Of course you could add additional 9 calculation worksheets referring to the according match day. However, this would bloat your workbook, make it harder to maintain and probably decrease the performance.

So here is a better way: use a small VBA routine to create a history table containing the position of all teams during the whole season:

Sub RecalculateTableDev()
  Dim varmatchday As Integer
  Dim rngMatchDay As Range
  Dim rngTableDevStart As Range
  Dim rngTablePosition As Range

  Application.ScreenUpdating = False
  Set rngMatchDay = Range("myMatchDay")
  Set rngTableDevStart = Range("myTableDevStart")
  Set rngTablePosition = Range("myTablePosition")
  Range("myTableDevRange").ClearContents
  For varmatchday = 1 To 34
      rngMatchDay.Value = varmatchday
      rngTableDevStart.Offset(0, varmatchday).Value = rngTablePosition.Value
  Next varmatchday
  rngMatchDay.Value = 34
  Application.ScreenUpdating = True
End Sub

The technique is simple: Loop through all match days, let the Excel workbook do the math and write the positions of the teams to the history table. Finally set the actual match day to the last one (i.e. display the final league table).

Agreed, there is a drawback as well: the VBA takes some to time to create the history table. Though, an update of the history is only necessary if the user switches either to another season or another league. From my point of view this drawback is acceptable.

The download links

Here is the example workbook for the German 1. and 2. Football Bundesliga for free download:

Download Bundesliga (Microsoft Excel 2003, zipped 223.4K)

I can already hear you saying: “who cares for the German Bundesliga”? Well, I do. If you don’t, maybe you will be more interested in the following workbook for the English Premier League:

Download Premier League (Microsoft Excel 2003, zipped 203.0K)

Please be advised that both workbooks are based solely on the match results. Thus, the tables provided within these workbooks do not reflect any possible point penalties because of e.g. breach of license terms, match manipulations, fan riots, etc. The tables are reflecting the sports, nothing else. They do not necessarily represent the official tables.

What’s next?

As already foreshadowed in the introduction, I am planning to do another post on visualizing FIFA World Cup statistics. I am not sure whether I will make it in time (less than 2 weeks left), but I am working on it.

Stay tuned.

Update on Sunday, December 11, 2011

Some readers asked for an update of the workbook including the season 2010/2011 of the English Premier League. Here it is:

Download Premier League until 2010/2011 (Microsoft Excel 2003, zipped 210K)

Comments

20 responses to “Combine Tables and Charts on Excel Dashboards”

  1. Neil Avatar
    Neil

    Absolutly brilliant Robert! My mind has already slipped into hyperdrive working out how I could utilise this to bulid a dashboard for project I have. Thanks to you the project is now less of a scary monster! Thanks again.

  2. Daniel Avatar
    Daniel

    Excellent work. Let me know when you’ve added a feature to analyze the upcoming games and we can all get rich when the next season starts.

  3. Ulrik Willemoes Avatar
    Ulrik Willemoes

    Wow – this is great stuff! I just keep being amazed with the way you explore the data visualization potential of Excel!
    I also admire the way you structure your workbooks! I can see it really pays off (in terms of performance and scalability) to spend the extra time doing this, so your method will definitely be an example to follow for me.
    Thanks for sharing & keep up the great work!

  4. Marko Avatar
    Marko

    Gr8 work!
    I took the liberty of modifying your Premier League dashboard a little (smoother colors, adjusted the chart bars to stay in the middle of a cell, W%,D%,L% values are now displayed in chart). You can download it here: http://dl.dropbox.com/u/2332610/premier_league.xls
    Hope you don’t mind my changes.
    Bye,
    Marko from Slovenia

  5. Robert Avatar

    Marko,
    many thanks for your comment.
    Of course I do not mind at all! All files provided here are meant to be downloaded, used, adapted to your requirements, improved, etc…
    Thanks also for sharing your workbook. Here are my 2 cents:
    a. I think the colors are somehow a matter of taste. The color selection in my workbook was based on traffic light colors, but I like your selection as well.
    b. One of the big disadvantages of combining tables and charts is the way Excel is rendering charts in different version and different zoom factors. Your version looks perfect with Excel 2003:
    Premier League Screenshot 2003
    However, with Excel 2007 the same file does not look perfect anymore:
    Premier League 2007
    Here is a screenshot of Excel 2007 using a zoom factor of 160%:
    Premier League 2007 160%
    As I said, a big disadvantage of the presented technique: You have to optimize the position and size of the charts for the version of Excel you will be using.
    c. Displaying the values in the stacked win-draw-losses bar chart is an option to include even more information into the table. However, I would suggest using a custom number format to suppress the zero values (like “#,##0;;”). Especially for the first few match days, when a lot of teams have some zero values for wins, draws and losses, suppressing the zero values makes the chart more readable.
    Thanks again for your comment and stay tuned.

  6. John Avatar
    John

    Hi Robert ,, I recently came across your Dashboard using a scroll bar, which although fairly simple, it is very effective ( and I will be using that technique in some data dump files of my own ) …. one question, I’ve been using the scroll bar with a data file I have with data for the 3rd qtr of this year, however, I also look at the data for 4th qtr, I can create a second scroll bar table for 4th qtr below the one for 3rd qtr, but is it possible to have them scroll together ,,, e.g. if I scroll down on one of the tables, can the second one be set up to scroll automatically?

  7. Robert Avatar

    John,
    thanks for your comment and question.
    No sweat: simply link both scroll bars to the same target cell. Whatever scroll bar you will be using, the other one will scroll up and down accordingly.
    However, I was wondering why you display the 4th quarter below the 3rd one. Wouldn’t it be better to add additional columns in one table? Thus, you would see KPIs by quarter and could improve insights on the trend by adding a column displaying the delta in absolute numbers or percentages.
    If the problem is the limited real estate on your dashboard (because you may have too many KPIs): I would recommend splitting the tables by KPIs instead of splitting it by quarters.
    Or am I barking up the wrong tree here?

  8. John Avatar
    John

    Hi Robert ,, it’s ok ,, I managed to figure it out myself ,,,, but thanks again for the idea, great way to look at specifics without more complex formulas etc.

  9. John Avatar
    John

    Hi , No, your not barking, just the way I like to display things ,,, qtr’s split out then add charts or graphs below that ( which is my next step, to link the chart to the data captured within the scroll bar )then it is easier to print off on one page. So, i’ll go work on that piece, see if i run into any problems there, but thanks for the feedback, appreciate it.

  10. brandhuber Avatar
    brandhuber

    It’s fantasic thats what I need for a long time ago. Altough It’s not workking properly the ‘Calculation position’but I dont know why.
    I put the current season data into the table(11 round)and I could not find out why not show the correct positons on each teams. Anyway, on the “last ten positions” consist of false information too. where the bugs are ?

  11. Robert Avatar

    Ferenc,
    thanks for your message. To be honest, I do not understand the problem you are facing. Do you mean the rankings of the teams are not correct in the table? I cannot reproduce this.
    Regarding the last ten positions: I guess you are aware of the fact that you have to run the VBA sub after you pasted in new data? The VBA sub is triggered after selecting another season using the drop down combo box.
    Can you elaborate a bit on what exactly the issue is or – even better – can you send me your workbook by email?

  12. medichy@gmail.com Avatar
    medichy@gmail.com

    Hi,
    It looks great, Do you have the premier league excel updated to season 2010-2011?
    Thanks

  13. Robert Avatar

    medichy,
    I just updated the post including a link to the workbook for download at the end of the article.

  14. Nigel Avatar
    Nigel

    Hi Robert,
    Rather than matchdays, where there are always 10 games in a matchday, could this also be done on a day to day basis?
    For example, sometimes there are 7 games in one day, usually a Saturday, 2 on a Sunday, and one on a Monday. Could this be done, maybe with the dates somewhere in the dash board too?
    Thanks

  15. Robert Avatar

    Nigel,
    in general I do not see why this shouldn’t be possible.
    First of all you would have to organize the exact dates of the matches. My data only contains the match days of all games, but not the dates.
    Next, it depends on what exactly you are trying to achieve. If you want to keep the dashboard as it is and simply display the exact date of each match close to the fixtures (the list of results at the top right), this would not require many changes. The additional data and some INDEX formulas would probably do the job.
    Having said that, if you want to show the current status of the Premier League for any given date on the dashboard (e.g. the table, fixtures and statistics on Saturday evening although the Sunday and Monday matches are still missing), this would be a different story. To achieve this, you would probably have to revamp more or less the entire workbook. The logic of the model I posted for download is based and heavily relying on the match day. Hence, you would have to change a lot of formulas and the VBA (calculating the positions of the teams) to make this possible.

  16. Ian Avatar
    Ian

    hi Robert this is great but im quite new with excel im also a football manager of a kids team and think this is great to keep track of the season but we only have 11 teams in the league how can I adjust all the details to reduce it to the number of teams required without mucking up data also the number of games per day and season.
    thanks
    Ian

  17. Robert Avatar

    Ian,
    thanks for your comment. No big deal, but too much to explain in a comment. I will send you a template for 11 teams by email.

  18. Onditi Avatar
    Onditi

    I am trying to
    create a model for prediction football outcomes and I was wondering if
    you have some templates I can manipulate. Or you ould give me some
    pointers.
    Thanks and hoping to hear from you.

  19. Robert Avatar

    Onditi,
    unfortunately: no, I have never done anything in the field of sports results prediction. And even if I would: don’t get me wrong, but if I would have a model at hand reliably predicting the results of future football matches, I don’t think I would share it for free.

Leave a Reply

Your email address will not be published. Required fields are marked *