Sunteți pe pagina 1din 8

10/1/13

Show Details On-demand in Excel [Tutorial + Training Program] | Chandoo.org - Learn Microsoft Excel Online

Show Details On-demand in Excel [Tutorial + Training Program]


Posted on April 7th, 2011 in Charts and Graphs , products , VBA Macros - 44 comments

3d Printer Buyers Guide


www.3DSystems.com

Full Color & Cost-Effective Options Get


the Latest Guide to 3D Printing

Yesterday, we have seen a beautiful example of how showing details (like distribution) on-demand can increase the effectiveness of your reports. Today,
we will learn how to do the same in Excel.

Before jum ping in to the tutorial,


In this post, I have explained one technique of using charts + VBA to dynamically show details for a selected item. There are 4 other ways to do the
same viz. using cell comments, pivot charts, group / un-group feature and hyperlinks. I have made a 45 minute video training explaining all the 5
techniques in detail. Plus there an Excel workbook with all the techniques demoed. You can get both of these for $17.
Click here to get the video training Showing on-demand details in Excel
[Alternative payment link]

How does the on-demand details chart work demo:


This is a replica of yesterdays chart from Amazon. When you click on any cell inside the Items + Rating table, the corresponding items review break-up is
shown in the chart aside.

Creating this chart in Excel Step-by-step Instruction


So you are ready to learn how to do this chart? Great, grab a cup of coffee or tea and get started.

1. Understanding the data


This is how I have setup the source data for the chart. It has 3 columns Item name, Reviewer ID and Rating. Each item has several ratings from several
different reviewers. And our goal is to summarize all these ratings.

chandoo.org/wp/2011/04/07/show-details-on-demand-in-excel/

1/8

10/1/13

Show Details On-demand in Excel [Tutorial + Training Program] | Chandoo.org - Learn Microsoft Excel Online
All this data is in the range Table1. We will use structured references [what are they?] in formulas to keep them readable.

2. Setting up the Item & Rating Table


The first step is to show a table with all the products we sell and their corresponding average rating. We will then add the circle indicators at the end to
visually show the rating.

Calculating the averages using AVERAGEIF() formula:


The formula is quite simple. Assuming the product names are in C5:C13,
We just write =AVERAGEIF(Table1[Item],C5,Table1[Rating]) for first products average. Fill the rest by dragging the formula down.
Displaying Circles:
There are no star symbols in the default fonts. But we have circles a full circle, an empty circle and a donut to
indicate half-circle. These symbols are available in Wingdings 2 font. We will use an incell chart to display the
circles. Assuming the rating is 2.83, we need to print 2 full circles, one donut and 2 empty circles. [related:
inserting symbols in to Excel workbooks]
The formula is quite simple. Since the ratings are in D5:D13, the formula becomes,
=REPT(fullCircleSymbol,INT(D5)) & REPT(donutSymbol,(INT(D5)<>D5)+0) & REPT(emptyCircleSymbol,INT(5-D5))
Naming this grid
Now that we are done with the rating grid, let us name it rngRev iews.

3. Finding out which cell is selected


Now comes the macro part.
Before jumping in to the code, take a sip of that coffee. It is getting cold.
When a user selects any cell inside rngReviews, we need to findout which product it is so that we can load corresponding details.
The macro logic is quite straight forward.
1. On Worksheet_SelectionChange, check if the ActiveCell overlaps with rngReviews
2. If so,
1. findout the relative row number of ActiveCell with respect to topmost row in rngReviews (ie the position of selected cell inside rngReviews)
2. Put this value in to a cell on worksheet say E28
The macro code can be found in the downloaded workbook. Here is an image of macro code.

4. Using the macro output to drive,


We need to use the value E28 to do 2 things.
1. Highlight the corresponding row in the rngReviews using conditional formatting.
2. Findout the corresponding product using INDEX formula.
I am leaving both of these to your imagination.

5. Calculating Product Rating Breakup


In order to show details for the product, we must calculate the corresponding breakup of ratings (ie how many 1 star, 2 star 5 star reviews the product
got).
I am leaving the formulas for this to your imagination. But when you are done, make sure your output looks like this:

(hint: use COUNTIFS formula).

6. Create a Chart to show Rating Break-up


This is the last one before we put everything together. Just follow below 5 steps.
1. Select the 3 columns Rating type, number of reviews, total reviews and create a bar chart (not stacked bar chart). In my workbook, this data is in
the range C29:E34 in the sheet Rating Summary.
2. Reverse the order of categories as Excel shows them upside down. For this select the vertical axis and hit CTRL+1 (or go to axis options from right
click menu). Here check the Show categories in reverse order option. Also remove the chart legend.
3. Set both series of the chart such that they completely overlap each other [image]. Adjust the gap width to 50%. Also, adjust the order of the series
from Charts source data options [image].
4. Remove grid lines, axis line and horizontal axis. Format the chart colors to your pink and translucent green (really!).

chandoo.org/wp/2011/04/07/show-details-on-demand-in-excel/

2/8

10/1/13

Show Details On-demand in Excel [Tutorial + Training Program] | Chandoo.org - Learn Microsoft Excel Online
5. Re-size the chart, add title, add labels, remove border. You need to use dynamic titles.

7. Put everything together


Now is the time to put everything together and test. Move the chart close to the rating table. Test it by clicking on any value inside table.
You can also do some colorful formatting if you prefer.

Finish the coffee and show-off the chart to a colleague or boss. Bask in glory.

Download Example Workbook On-demand Details in Excel


Click here to download the workbook with this example. Play with it to understand how this chart works.
Note: You must enable macros to use the file.
Note2: If the file does not open on double- click, just open Excel (2007 or above) and drag the file inside to Excel.

Learn this + 4 other techniques using Video Training,


In this post, I have explained one technique of using charts + VBA to dynamically show details for a selected item. There are 4 other ways to do the
same viz. using cell comments, pivot charts, group / un-group feature and hyperlinks. I have made a 45 minute video training explaining all the 5
techniques in detail. Plus there an Excel workbook with all the techniques demoed. You can get both of these for $17.
Click here to get the video training - Showing on-demand details in Excel
[Alternative payment link]

How do you like this chart?


Ever since I learned this technique from a good friend, I have been using it in dashboards & complex models to make them more user friendly.
What about you? Did you like this technique? Where are you planning to use it? Please share your views & ideas using comments.

More Resources to One-up your Chart Awesomeness


Want more, here is more:
Grammy Bump Charts a dynamic excel chart
Showing same data in multiple views
Using Checkboxes to make dynamic charts
More on Excel Dynamic Charts
More on Excel Charts

44 Responses to Show Details On-demand in Excel [Tutorial + Training Program]


1.

Arnab says:
April 7, 2011 at 9:27 am

chandoo.org/wp/2011/04/07/show-details-on-demand-in-excel/

3/8

10/1/13

Show Details On-demand in Excel [Tutorial + Training Program] | Chandoo.org - Learn Microsoft Excel Online
Hi Chandoo,
At the beginning of the week,you promised,about a dashboard,celebrating team Indias victory at the WC.where is it ?
Reply
2.

Javier says:
April 7, 2011 at 10:25 am
Un fantstico tutorial. Muchas gracias
Reply

3.

dan l says:
April 7, 2011 at 1:14 pm
I really like to use click for details in my projects.
The more and more complicated workbooks I do, the more I really think that form controls kind of suck. They have their place, but they really do sort
of break up the flow of the workbook. Click to explore feels very webish, so its a good solution.
Reply

4.

John Kyle says:


April 7, 2011 at 2:08 pm
This is really cool, Chandoo. I can see how this would be a very helpful part of a dynamic Excel dashboard. Thanks for showing us, once again, how
we can have very powerful Excel reporting without too much difficulty.
Reply

5.

Dave says:
April 7, 2011 at 4:58 pm
I dont know how to open an excel 07 Zip file. After I unzip there are a number of folders and sub folders, many with xml extensions. Where is the
xlsm or xlsx fiel?
Reply

6.

becha says:
April 7, 2011 at 5:05 pm
chandoo.U! R! a God!
cool knowledge indeed
Reply

7.

matt says:
April 7, 2011 at 7:58 pm
Hello,
How do you move the distribution totals outside of the grap area? Under Lable Position when I choose to move data points Outside_End it only
moves it outside the distribution bar, not the total. Is there another option?
Thanks
Reply

8.

Fred says:
April 7, 2011 at 10:47 pm
Thanks for the great lesson. other than the macro part, which I still have some issues with, how do you get the distribution count on the graph to
display outside the ligher color bars?
I tried to format the lable to show outside the lighter color bar. However, I can only make them to show up outside the darker color bar and so
the distribution numbers are not aligned. How do you make them all aligned to the outside of the lighter color bar?
Reply

9.

Jayant Joshi says:


April 8, 2011 at 5:07 am
i am learning lot from you thanks a ton
Reply

10.

ikkeman says:
April 8, 2011 at 6:05 am
The use of a half circle whenever the rating is not an integer is I think unnecessary. as it is, 2.01 and 2.99 will receive the same number of Circles.
Using the mod formula to test for a specific fraction allows you to use different sized or filled circles to indicate relative score below integer level.
REPT(fullCircleSymbol,INT(D5)) & REPT(donutSymbol,mod(D5,1)<0.5)+0) & REPT(emptyCircleSymbol,5-int(D5)-(mod(D5,1)<0.5))
Reply

11.

Ulrik says:
April 8, 2011 at 7:29 am
Thanks for a good post. It is a very nice integration of table and barchart!
It made me think .. suppose, for the sake of saving dashboard real estate, you wanted to be able to toggle the visibility of the barcharts. You could
then do the following, attaching the macro ToggleGroupVisibility to Group 3:
Sub UpdateAfterAction()
Dim topRow As Integer
Sheet1.Shapes(Group 3).Visible = True
Group 3 being the group with the barcharts
topRow = Range(rngReviews).Cells(1, 1).Row
[valSelItem] = ActiveCell.Row() topRow + 1
End Sub
Sub ToggleGroupVisibilty()
Sheet1.Shapes(Group 3).Visible = Not Sheet1.Shapes(Group 3).Visible

chandoo.org/wp/2011/04/07/show-details-on-demand-in-excel/

4/8

10/1/13

Show Details On-demand in Excel [Tutorial + Training Program] | Chandoo.org - Learn Microsoft Excel Online
End Sub
Reply
12.

Chandoo says:
April 8, 2011 at 8:25 am
@All.. Thank you so much for your comments. I am happy you liked this.
@Arnab: I got unusually busy this week. May be next week I will put a dashboard. I have all the data I need for this + made some progress. But I
need some more time.
@Dave: Just drag and drop the file in to Excel 2007.
@Matt & Fred: Very simple. First I set the labels for outside series. Then I manually assigned the labels to the inside values using formula bar. If you
would like to automate this, you can use Rob Beveys Chart Labeler http://www.appspro.com/Utilities/ChartLabeler.htm
@Ikkeman: I agree.
@Ulrik: Very good idea
Reply

13.

Cameron says:
April 8, 2011 at 7:33 pm
@Ikkeman & Chandoo:
A slightly different approach on the star ranking:
I have arranged my symbols from most filled to least filled in A1:A5
And the formula Ive used:
=REPT($A$1,INT(I1)) &
IF(INT(I1)=I1,",OFFSET($A$1,MAX(1,(CEILING(I1,1)-I1)*6),0))
& REPT($A$5,5-CEILING(I1,1))
I imagine a different formula could be used to generate a better spread between the symbols. Currently the breaks are on .33/.34 .50/.51 .66/.67
Reply

14.

Cameron says:
April 8, 2011 at 7:38 pm
@Myself: Duh!
=REPT($A$1,INT(O25))
&IF(INT(O25)=O25,",OFFSET($A$1,MIN(4,MAX(1,(CEILING(O25,1)-O25)*6)),0))
&REPT($A$5,5-CEILING(O25,1))
The MIN is very important!
Reply

15.

Cameron says:
April 8, 2011 at 7:57 pm
And now Im amusing myself by making filled-circle Sine waves march across my spreadsheet.
I thought this blog was about PRODUCTIVITY?
Reply

16.

Hui... says:
April 8, 2011 at 11:01 pm
@cameron
Look how productive youll be next time the boss asks for a chart with filled circle sin waves!
Reply

17.

ahamed rifkan says:


April 9, 2011 at 5:48 am
Hi Chandoo
I would give five stars for this lesson
and its one of great lesson I learned from you. Thank for bringing up this kind of great excels. I would say it
is a attempt to think out of the box .. !
Reply

18.

Istiyak says:
April 10, 2011 at 5:53 am
I want to share this with u guys..
https://cid-c6f0db2b5c8a20d3.skydrive.live.com/redir.aspx?resid=C6F0DB2B5C8A20D3!104&authkey=GMtDjGMi93Q%24
This convert numeric figures to words.
Reply

19.

Istiyak says:
April 10, 2011 at 5:56 am
Sorry For damaged link
here is new
https://cid-c6f0db2b5c8a20d3.skydrive.live.com/redir.aspx?resid=C6F0DB2B5C8A20D3104&authkey=GMtDjGMi93Q%24
Regards
Istiyak
Reply

20.

Istiyak says:
April 10, 2011 at 6:00 am
Sorry For Inconvenience

chandoo.org/wp/2011/04/07/show-details-on-demand-in-excel/

5/8

10/1/13

Show Details On-demand in Excel [Tutorial + Training Program] | Chandoo.org - Learn Microsoft Excel Online
New Working Link is here
https://cid-c6f0db2b5c8a20d3.office.live.com/self.aspx/.Documents/Words%5E_Template.xls
Thanks
Istiyak
Reply
21.

Cameron says:
April 10, 2011 at 10:35 am
@Istiyak, it appears that the file or folder would have to be shared in order to work, and its based off of Windows Live ID/registered email. Probably
not going to work here since you would have to share the folder with all the emails of the people who wanted to see it, and the emails remain
anonymous on this website.
Perhaps mediafire or some other file hosting option?
Reply

22.

Hui... says:
April 10, 2011 at 10:53 am
@Cameron
I openend the third link
Login to Skydrive first
Then paste the link
Download the file for best results as it doesnt work in Firefox
Reply

23.

Cameron says:
April 10, 2011 at 1:17 pm
/This folder might not be shared with you/
-It appears that you dont have permission to access My Documents. You might be trying to access it with a different account or might need to ask
the folders owner for permission to access it.
Istiyak, Id love to see this in action!
Is this in VBA or Excel Formulas?
Reply

24.

Istiyak says:
April 10, 2011 at 6:42 pm
@cameron and hui -thanks for ur attension. I will upload it any where else and share it with u. It is just with the help of formula. Give ur email i will
mail it to u. Hey hui whats ur veiw about that one?
Reply

25.

Hui... says:
April 10, 2011 at 11:59 pm
@Istayak
Well done, its well put together and a good piece of work
Great for One Ofs
But as a series of worksheet formulas, it lacks flexibility.
I think it is better handled as a User Defined Function as per the Microsoft link I previously sent you. Using a UDF allows it to be used anywhere and
multiple times in a workbook.
Reply

26.

Cameron says:
April 11, 2011 at 1:58 am
@istiyak
vertexvortex
(at)
gmail
Reply

27.

Istiyak says:
April 11, 2011 at 3:42 pm
@ Hui : Thanks for ur motivated Comment
@Cameron : Hi i had sent it to ur email id. Plz confirm once received..
Regards
Istiyak
Reply

28.

Hui... says:
April 12, 2011 at 2:43 am
For anyone trying to use Istiyaks links above and having problems:
1. Login to Skydrive first
2. Paste the link from Post 18 all the way to the %24
Istayaks Link
Reply

29.

Dave says:
April 12, 2011 at 4:27 pm
Chandoo, Im still a bit confused, what exactly is it that I drag and drop to excel.
I am unzipping and getting quite a few files, mostly with xml extensions. I drag anyone of these to an open workbook and get the schemas but no
working file.
if I drag the zip file to excel workbook, I get asci type of data in the workbook.
Thanks and sorry for being so thick on this one.
Reply

chandoo.org/wp/2011/04/07/show-details-on-demand-in-excel/

6/8

10/1/13

Show Details On-demand in Excel [Tutorial + Training Program] | Chandoo.org - Learn Microsoft Excel Online
30.

Hui... says:
April 12, 2011 at 10:15 pm
@Dave
Try renaming the file to *.xlsx
Where the * is the filename
Now try and open in Excel
Reply

31.

Rahul says:
April 13, 2011 at 8:47 pm
Hi Chandoo,
Thanks again for the awesome tip. Have a question. When i overlap the two charts, both of them becomes of the colour and i get single colour bars.
Anyone on this ???
Reply

32.

Anushri says:
April 18, 2011 at 6:52 am
Hi Chandoo,
Thanks, but I have excel 2003 where some formula do not work. I faced similar issues in Dynamic Dashboard file share by you earlier.Is there any
alternate for averageif and sumifs in excel 2003..will be a big help for me. Im a beginner and do not know much about this.
Thanks
Reply

33.

Hui... says:
April 18, 2011 at 9:02 am
@Anushri
AverageIfs and Sumifs can be replicated by using Sumproduct.
.
Sumifs(Range1, Criteria1, Range2, Criteria2)=Sumproduct((Range1=Criteria1)*(Range2=Criteria2))
.
Averageifs(Range1, Range1, Criteria1, Range2, Criteria2)=Sumproduct((Range1=Criteria1)*(Range2=Criteria2),SumRang1)/Sumproduct(1*
(Range2=Criteria2))
Reply

34.

Anushri says:
April 18, 2011 at 12:03 pm
Thanks Hui!
I tried following formula in the Dynamic Dashboard CH1; All Products & YTD:

=IF($C$21=$L$22,SUMPRODUCT((Data!$C$2:$C$141=CH1!B24)*Data!$G$2:$G$141),IF($C$21=$M$22,SUMPRODUCT((Data!$C$2:$C$141=CH1!B24)*Data!$H$2:$H
I pasted KPI parameter names in cells I22 to O22.
It worked fine but its cumbersome specially if I have 10 KPI parameters (here it was only 4)
Please suggest if I could have used any shortcut in Excel 2003 for this
Tx
Anushri
Reply
35.

Anushri says:
April 18, 2011 at 12:07 pm
Guess formula did not appear in previous post. Here is what I used

=IF($C$21=$L$22,SUMPRODUCT((Data!$C$2:$C$141=CH1!B24)*Data!$G$2:$G$141),IF($C$21=$M$22,SUMPRODUCT((Data!$C$2:$C$141=CH1!B24)*Data!$H$2:$H
Please suggest if there can be a shorter way
Reply
36.

Hui... says:
April 18, 2011 at 1:54 pm
@Anushri
Yep, that will get messy with 10 KPIs, except that you cant nest that deep with Excel 2003 anyway.
Is this the only formula like this or is it repeated hundreds of times ?
Can you do all the Sumproducts in named ranges ?
Can you upgrade to 2010 ?
Reply

37.

Hui... says:
April 18, 2011 at 2:08 pm
@Anushri
You could try simplifying your formula also to:
`=SUMPRODUCT((Data!$C$2:$C$141=CH1?!B24)*OFFSET(Data! $G$2:$G$141,,IF($C$21=$L$22,0,IF($C$21= $M$22,1,IF($C$21=$N$22,2,3)))))
`You might want to check the logic just in case

Reply
38. Sales Analysis Charts in Excel - 78 Alternatives | Chandoo.org - Learn Microsoft Excel Online says:
June 30, 2011 at 8:47 am
[...] Using form controls Display on-demand details in excel charts Panel [...]
Reply
39. Interactive Dashboard in Excel using Hyperlinks | Chandoo.org - Learn Microsoft Excel Online says:
July 20, 2011 at 9:06 am
[...] Display on demand details in your excel charts [...]

chandoo.org/wp/2011/04/07/show-details-on-demand-in-excel/

7/8

10/1/13

Show Details On-demand in Excel [Tutorial + Training Program] | Chandoo.org - Learn Microsoft Excel Online
Reply
40.

Damian says:
August 2, 2011 at 2:14 pm
Hola chandoo le escribo desde Argentina. Realmente su pagina es excelente, muchas gracias por su aoporte a la comunidad.
Saludos y muchas gracias!
Damian.
Reply

41.

Jav says:
September 20, 2011 at 8:46 am
Hi Chandoo,
Have a question, I wanted to put 2 charts in same sheet, but it doesnt work.
Something have to do with this Private Sub Worksheet_SelectionChange(ByVal Target As Range). can u help?
Reply

42.

Ahsan says:
April 15, 2012 at 8:46 am
Thanks Chandoo for Excel Tricks
Reply

43.

Shaz says:
May 12, 2012 at 2:20 pm
Excellent tutorial Chandoo!
This is a silly question, but when adding the data labels I am having difficulty with alignment at the end of the bar. If the data labels are for the
distribution series, the outside end does not display outside of the total series. If they data labels are manually adjusted, they come out of
alignment when the selection changes. So Im wondering how you were able to get the data labels for the distribution series to display in the
outside end of the Total series. Probably something real simple that I am overlooking

Reply
44. Excel Dashboard Examples - 66 Dashboards to Visualize Excel salaries around world | Chandoo.org - Learn Microsoft Excel Online says:
July 31, 2012 at 3:08 am
[...] Adding interactivity using click-able cells [...]
Reply

Leave a Reply

Give more details by showing average and


distribution [Charting Tips]

chandoo.org/wp/2011/04/07/show-details-on-demand-in-excel/

Auditing Spreadsheets? Disable Direct Editing


Mode to save time [quick tip]

8/8

S-ar putea să vă placă și