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 jumping 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
How does the on-demand details chart work – demo:
This is a replica of yesterday’s 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.
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 product’s 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 – rngReviews.
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.
- On Worksheet_SelectionChange, check if the ActiveCell overlaps with rngReviews
- If so,
- findout the relative row number of ActiveCell with respect to topmost row in rngReviews (ie the position of selected cell inside rngReviews)
- 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.
- Highlight the corresponding row in the rngReviews using conditional formatting.
- 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.
- 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”.
- 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.
- 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 Chart’s source data options [image].
- Remove grid lines, axis line and horizontal axis. Format the chart colors to your pink and translucent green (really!).
- 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
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:
29 Responses to “You are invited [personal]”
Dear Sir,
This is to just Wish the kids a Happy birthday in Advance.May Almighty bless them all strength,Success
Dear Chandoo,
My best wishes to your child.I had become regular visitor of your site and finally today it made me to post a comment...
Best wishes from my end! Dont think it would be possible to personally come .. but my best wishes would always be there!! 🙂
Chandoo, thank you for the kind invitation. I wish a special birthday day for your daughters, Nishanth & Nakshatra. Will you be serving "dudh pakh"?
-bill
What a kind thought to invite us!
I pray your family will be continually blessed.
Thank you very much for the invitation, how I wish Philippines is just a Jeepney ride away from India. Best wishes for your baby girls and more blessings to come.
Hi Chandoo,
Thanks for the invitation ! You treat everyone that comes to your site as part of your family community. Me and my family wishes Nishanth & Nakshatra a very very happy birthday !!
Though physically we cant be with you to celebrate the occasion, you know our blessing are with you !
To be a father is not easy, furthermore you have to be a father to 2 kids !
Francis
Dad of 2 and 9 year old.
Hi Chandoo,
It was very kind of you to invite us all along to the 'Extravaganza'. Like others that have commented here I too, am to far (Australia) to pop over for a piece of cake 🙂 Best wishes to you and your family on such a milestone.
Emma
(soon to be mum of 1!!!)
Dear Chandoo
God bless Nishanth & Nakshatra. Wishing you and your family a very enjoyable first birthday party.
(Father of a 9 month baby... wondering how you manage 2 !!! )
God bless the little ones. Have a blast.
Hi Chandoo
Happy birthday !
Indeed children are a blessing and make our lives much more deeper.
Wow! I wonder how that would look; all those Excel users partying with your cute kids!
Enjoy the festivities and remember; they grow up really fast.
Dear Chandoo,
Thanks for your invitation!
Please accept my wishes for Nishanth & Nakshatra, and a very very happy birthday to both of them.
(Father of a 1 year old baby)
Hi Chandoo,
Thanks for the invitation. Wishing Nishanth and Nakshatra a very happy birthday and God bless all of you!
Howdy Chandoo,
Gosh, would love to attend the birthday party for your little blessings but I live in Dallas, TX. The children are beautiful. Thank you so much for the Excel information, tips, hints, special formulas, etc., you and your children are really a blessing. I look forward to your e-mails and check your web site frequently. Regards, Lynn
Chandoo Garu,
Your kids look adorable. Congratulations. My Aashirwaadam to both of them.
Regards,
Kalyan Verma
@all: Thank you every one for the wishes, blessings and prayers. We are very excited and busy with the birthday preps now. I will share a pic or two when its over... 🙂
Wish you and your entire family all the blessings. May god provide your babies with all the love and charm in the entire universe.
Like Emma I am rather far away (South Africa), but best wishes to you and your family on this special occasion.
(Mother of 7 and grandmother of 5)
Dear Chandoo,
May God Bless your little ones with Good Health... Happy birthday to them from me... Wish i could be there but work doesn't permit me to travel 🙁
And thanks again for treating all of us like your family
Rajatha
Sir.
God bless the two little angels with all the happiness in the world.....
Wishing Nishanth and Nakshatra a very happy first birthday. My youngest has just turned 18, and I wish you and your family every happiness in the exciting journey ahead.
Hi Chandoo,
I'm reading your blog for more than a year now, and i'm very pleased by this invitation.
I wish a very special Happy Birthday to the 2 little ones from Mauritius Island.
If, for any reason, you are coming on the island in the future, feel free to drop me a mail.
Have a nice party, and a nice year to come with Nishanth and Nakshatra.
Happy birthday!
Your babies are beautiful!
This year is not possible for us to attend. My family will be there for your next family party.
Enjoy the cake and dinner
May God Bless your little ones with Good Health… Happy birthday to them from me....I am also the father my little daughter named akanksha, she is 2.5 yrs old,,,,but i am unemployed 2 yrs ,,i know when u become a dad u r many hopes.
Guru
My belated wishes for your kids... I feel sorry for having missed them to wish to the right time.... May almighty shower all his blessings on your family.....
With regards
Chandoo,
Congratulations. Please give you children a big Happy Birthday (one day late) from me. Enjoy, they grow up very fast
Gene
@all.. thanks for the wishes and blessings. We had a fantastic weekend with all the relatives, friends. Kids loved the cake, enjoyed the beach and had fun playing with gifts. Here are some photos..
Chandoo & family - greetings from Ireland, hope you enjoyed the day!