27/11/2011

Creating in-cell bar charts / histograms in excel

Ever since writing the create in-cell pie charts in excel, I have been itching to find a simple enough method to do incell bar graphs. An in-cell bar would probably be more useful and cuter than an in-cell pie as it can instantly provide trending details. What more, these would probably look gorgeous when printed out.

My first challenge was that there was no font readily available for bar graphs. Thankfully this is when I noticed Font Struct, an online font creator / editor. I quickly created a bar graph font using their wonderful editor. When you use bargraph font, 0 through 9 will show bars of increasing heights, as shown below.




You should download bargraph font if you want to use incell bar graphing technique mentioned here.
Once you have downloaded the font, the rest is simple process. For this example, lets use fictitious sales data of various beverages over the last 12 months. The initial data table is something like this:



  1.  First we will insert a column next to the total sales column and call it “last 12 months”. We will use this column to fill up the in-cell bar graph for the last 12 month sales. 
  2.  Next we need to normalize the sales values for each month to a value between 0 to 9. I have used linear normalization, ie the maximum value across the 12 months would be 9 and everything else will be normalized according this. The formula for one month looked something like this: =ROUND(jan_sales/MAX(all_sales)*9,0). Remember, we need to round the data make it one digit instead of a decimal.
  3. Once we have normalized values for each of 12 sales figures for each row, we just need to concatenate them to create a 12 character long string of numbers and place this values in our newly inserted column
  4. Finally, we will change the font of this column to “bargraph” (just select all the cells under the “last 12 months” and change the font) When we are finally done, our table should look something like this:


    Thats all, we now have a charming data table with cute little incell bar graphs to insert your project report / sales memo or news letter.
 Feel free to download example excel sheet I have created and learn how to do in-cell bar graphs

Remember, you need to have the bargraph font installed first. 

Do you like this? share your feedback.

No comments:

Post a Comment