Earlier in the week Chandoo presented Give more details by showing average and distribution
At the top of the post was a small screen capture from Amazon.com showing a 5 Star chart showing that Twilight had a 3.5 Star Rating (way over-rated if you ask me).
I received an email shortly afterwards from Rajiv, “How can I make one of those charts ? ” with the Stars Circled
It’s actually very simple and this post will show you how.
The Technique
The technique involves putting a mask in front of a single bar from a Bar Chart
The mask has a plain background and has cut-outs where the Stars are, which are transparent and so only the bar chart shows through in those areas which are cut out.
Lets Do It
On a worksheet we need a cell where we have a Rating Value, lets use B2
Make the value in Cell B2, 5
Select the cell B2 and Insert Chart
Insert a Bar Chart (Clustered Bar)
Delete the following chart objects
- Title
- Legend
- Major Grid Lines
Select the Horizontal Axis
Format Axis
Change the Horizontal Axis Scale to
- Minimum 0
- Maximum 5
Delete the Horizontal and Vertical Axis
Move the chart and resize the Bar to your requirements
Change the Bar’s Fill to suit
Set Border color to No Color
Insert Picture
Import the 5 Star mask attached here
Position the mask in front of the charts Bar
With the mask selected shift the Right hand side and then left hand side so that you can just see the edges of the bar.
Check the placement by trying the numbers from 0, 1, 2, 3, 4, 5 and 0.1 in B2
You should see all the stars perfectly when the placement is correct
Select the Chart and 5 Star Mask together
Use Shift while selecting each one
Group the Chart and Mask together, so that they can’t be moved
Your are free to shift and resize this combined object on your worksheet as required
Vertical Charts
A Similar technique can be used for Vertical Charts using a Column Chart instead of a Bar Chart
Masks
The masks used here were made in CorelDRAW, but can be made in any Drawing/Paint program like Paint.NET, that allows you to save PNG’s with Transparency effects
The masks consists of:
- 5 Stars which have no outline color and are transparent
- 1 Rectangle which is White with no Outline color
The 6 objects are then Joined enabling the holes of the Stars to show through the White Rectangle
Using this technique any shape can be used as a mask
I have included the following masks for you to practice with or use:
5 Stars Mask with Outlined Stars,
If anybody knows how to join objects together in Excel to make holes through them as required here, Please let us know in the comments below:
Thermometer Charts
The above technique is great for application to Thermometer Charts, where the Thermometer can take on all values from 0 to 100% or 0 to $200,000
or whatever you require.
Files
All the above examples are shown in one file which you can download here or here for the 2003 Version
Download the Waves and Chameleon 2007 or Waves and Chameleon 2003 examples
Extensions of the Technique
This technique can be extended in a number of areas
The Thermometer chart above shows one such area
The other is applying multiple Masks to multiple Bars/Columns in one chart, But I’ll leave you to practice that.
Limitations of the Technique
Two main limitations of this technique are:
Scaling
As Excel charts are scaled, Excel internally decides what space should be between the Plot Area, Titles and the edge of the Chart Area. This is not maintained constantly and hence the Plot Area may scale at a different ratio to the Chart area and overlying mask.
If this happens Ungroup the Chart and mask and reset ecverything at the new size.
Mask Color
The mask has a Fixed color, in the above examples it is white.
The mask cannot be colored in Excel to Match the background color of the Worksheet if it isn’t white.
So a new Mask will need to be made.
What Do you Think of this Technique
What Do you Think of this Technique?
How else can you see this technique being extended?
Let us know in the comments below:


























13 Responses to “Convert fractional Excel time to hours & minutes [Quick tip]”
Hi Purna..
Again a great tip.. Its a great way to convert Fractional Time..
By the way.. Excel has two great and rarely used formula..
=DOLLARFR(7.8,60) and =DOLLARDE(7.48,60)
basically US Account person uses those to convert some currency denomination.. and we can use it to convert Year(i.e 3.11 Year = 3 year 11 month) and Week(6.5 week = 6 week 5 days), in the same manner...
This doesn't work for me. When applying the custom format of [h]:mm to 7.8 I get 187:12
Any ideas why?
@Jason
7.8 in Excel talk means 7.8 days
=7.8*24
=187.2 Hrs
=187 Hrs 12 Mins
If you follow Chandoo's instructions you will see that he divides the 7.8 by 24 to get it to a fraction of a day
Simple, assuming the fractional time is in cell A1,
Use below steps to convert it to hours & minutes:
1. In the target cell, write =A1/24
2. Select the target cell and press CTRL+1 to format it (you can also right click and select format cells)
3. Select Custom from “Number” tab and enter the code [h]:mm
4. Done!
Hi, sorry to point this out but Column C Header is misspelt 'Hours Palyed'
good one
So how do I go the other way and get hours and minutes to fractional time?
If you have 7.5 in cell A1,
- Use int(A1) to get the hours.
- Use mod(A1,1)*60 to get minutes.
If you have 7:30 (formatted as time) in A1
- Use hours(a1) to get hours
- Use minutes(a1) to get minutes.
I had the same issue. You can solve it by changing the format as described above:
Right click cell > Format Cells > (In Number tab) > Custom > Then enter the code [h]:mm
([hh]:mm and [hhh]:mm are nice too if you want to show leading zeros)
Thanks guys, these are the tips I'm looking for.
...dividing the number of minutes elapsed by the percent change is my task - "int" is the key this time
It doesnt work for greater than 24 hours
It returns 1:30 for 25.5 hours. It should have returned 25:30
Ideally I would right function as
=QUOTIENT(A1,1)&":"&MOD(A1,1)*60
Sorry, replied to wrong comment....
----
I had the same issue. You can solve it by changing the format as described above:
Right click cell > Format Cells > (In Number tab) > Custom > Then enter the code [h]:mm
([hh]:mm and [hhh]:mm are nice too if you want to show leading zeros)
Clever use of MOD here to extract the decimal part of a number. Divide a number containing a decimal by 1 and return the remainder. Humm. Very clever.
Thanks very much, extremely useful !