Lightweight data exploration in Excel
By Chris Gemignani
July 31, 2006
Find more about:
excel
Lifehacker, delicious folks! This post generated a ton of great community ideas. Check out our followup post to see some more ideas and to download a spreadsheet with demos. Thanks.
We often are given a chunk of data in Excel that we need to explore. Of course, the first tool you should pull out of your toolbox in cases like this is the trusty PivotTable (it slices, it dices!). But at times we have to dig a little deeper into the toolbox and pull out the in-cell bar chart. Here's what it looks like.

This picture shows some Major League Baseball data. I'm graphing the number of walks each player has taken. The bar graphs are built using the Excel REPT function which lets you repeat text a certain number of times. REPT looks like this:
=REPT(text,number_of_times)
For instance, REPT("X",10) gives you "XXXXXXXXXX". REPT can also repeat a phrase; REPT("Oh my goodness! ",3) gives "Oh my goodness! Oh my goodness! Oh my goodness! " (my daughter's an Annie fan).
For in-cell bar charts, the trick is to repeat a single bar "|". When formatted in 8 point Arial font, single bars look like bar graphs. Here's the formula behind the bars:

What are some practical uses of in-cell bar graphs? For starters, they offer a good way to profile a dataset that has hundreds or thousands of rows. Here's a picture of in-cell bars compared to a standard excel bar graph for a dataset with about 500 rows. It can be a lot easier to scan the results when they're in-cell.


Another usage is lightweight dashboards. The report below compares a number of metrics for players using both in-cell bar graphs as well as conditional formatting. The conditional formatting highlights the top 25% of each metric in green and the bottom 25% in red, but that is a story for another day.






152 comments | Show all comments only the last 5 are shown
Steve said:
This is the most useful thing I've found all day. Thanks.
Clint said:
How long have you been sitting on this little nugget?
A much better presentation than the gradient cell-fills in Excel 2007!
Henk said:
Smooth trick, guys! Maybe the readers are interested in following.
You can extend this by conditional formatting, as you put, but another way is making bars growing to left or to right, depending when they are + or - values. Easiest way is to use two neighbouring columns, the left one for the negative values, the other one for the positive values. Use =IF(value0, REPT("|",value),"") for the positive column. "value" is the reference to the cell containing the repeat factor in the same way you described it. Make sure to right-align the column containing the "negative" bars, and to left-align the "positive bars. To increase the dramatic effect, format the negative column as red, the positive column as green.
Henk said:
Correction!
Reading over my post , I noticed that a line is missing. Maybe it was coincidentally deleted (it's approaching midnight here; I am not so sharp). Also ">" (the "larger than sign" disappeared so I write it in words to correct it.
Before "Use =IF" it should read ... For the negative values, use =IF(value "smaller than" zero, REPT(”|”,ABS(value)),""). Use =IF(value "larger than" zero, etc) ...
I can repost it if this looks interesting, but looks too messy.
Chris said:
Thanks Clint and Steve. Clint, I agree it's embarrassing how much better this solution is than what's planned for Excel 12 (here's the Excel 12 in cell bar chart by way of comparison http://blogs.msdn.com/excel/archive/2006/02/24/538875.aspx). Gradient fills!@#$!@$%!?
Great extension, Henk. Our blogging software ate your greater than sign. Burp.
Jon Peltier said:
Chris -
Nice demonstration of "less is more" and "keep it simple stupid". This is one of those elegantly simple approaches that everyone always forgets.
EricB said:
Wow, very cool. Simple and useful. Thanks!
Al said:
Seriously, I don't even use Excel that much, and I am very impressed by this. What a superb tip, and very clearly and simply explained. Thank you very much for taking the time to do this, I really appreciate it :)
Benjamin Selmer said:
Very usefull trick!
You can also use ASCII codes 177-178 or 219-223 instead of the pipe character. ASCII code 219 will give you a solid bar. Simply hold down the alt key and type 219, then release the alt key. Do the same for any other ASCII code. This works in most applications including Excel.
Do a google search for "ascii table" and you will probably find some nice tables of all the ascii codes.
derek said:
So simple! I knew about making little bars with REPT "X", especially for putting into plain text emails, but it never occurred to me to substitute little narrow characters for higher data density.
derek said:
With a bit more effort, some spaces, and two or more symbols, you could have dot plots comparing the values of two cells.
derek said:
With the appropriate width spaces for "task start", and bar-symbols for "task duration", you have a simple Gantt chart! In Arial Unicode MS, the four-per-em space (U+2005) seems to match the bar symbol for width.
Robbin said:
I used this today. Thanks. Have you found a typeface/size that works a little better than Ariel 8, i.e. where the pipes are so close that it is more seamless? (but I am not complaining. It is fabulous, can't wait to do my 10 am presentation.) Robbin
Chris Grant said:
Wow. I have never seen this anywhere.
Chris said:
This might almost make me like excel.
Clint said:
I\'ve been playing with this since yesterday, and just thought I\'d throw out there that you can achieve some nice ancillary effects using rept and concatenate, the simplest being adding a value label to the beginning or end of the bar.
Chris Grant said:
The fonts Stencil and Niagara Solid give solid bars.
eldoon said:
Oh my goodness, this is wonderful. And I thank you for showing us the ways of excel.
Chris Grant said:
Oops, sorry. Niagara Solid LOOKS solid at small sizes but isn't at large sizes. Stencil is definitely solid. Bold is bigger, too.
art steinmetz said:
I was never satisfied with REPT because of too much whitespace between characters so I had to slap my forehead when I saw how great your example looked. It's the font, dummy! It also got me thinking about the problem of representing negative values. Two columns is one way. Here is a single column solution:
=IF(a1>0,REPT(" ",M14)&"o"&REPT("|",a1),REPT("|",-a1)&"o"&REPT(" ",-a1))
The trick is keep everything vertically justified. Use center justification and find a font that is monospaced but narrow or where the SPACE character is the same width as the indicator character. I used Agency FB, the first font in my list!
o|||||||||
|||o
art steinmetz said:
Oops. this is the formula if the value in question in in cell "a1"
=IF(a1>0,REPT(” “,a14)&”o”&REPT(”|”,a1),REPT(”|”,-a1)&”o”&REPT(” “,-a1))
Clint said:
Art, maybe I'm being dense, but can you explain what value is being called by either the M14 or A14 cell reference?
Crashdaddy said:
That's great. Thanks!
Robbin said:
Britannic Bold does it solid too, but whomever suggested Stencil and Niagara is smart because it makes a shorter bar within the cell. (Or course, if your numbers are small, Britannic Bold is better.)
Another wonderful application here is Gannt chart work. So you specify the task in one cell, the number of days (weeks, months, whatever) in the second cell and then the third cell has the picture. And then there is no reason you can't color the pipes a different color for different tasks or phases...
Henk said:
Gantt Charts can be better made with a stacked bar chart where you hide the bars you just use for positioning the bars. E.g. Jon Peltier has some examples. [http://peltiertech.com/Excel/Charts/GanttChart.html]. It can be dynamic, and linked, with a few tricks. But for some "quick and dirty" Gantts in not too complex projects this REPT Charts can be good enough, indeed.
Paul said:
What a super tip! I have to scan lots of test data at the College where I work - this will save lots of eyestrain.
I'd love to see the conditional formatting solution you have devised for the percentile ranking.
Many thanks for the tip
Matt said:
Many Thanks.
This is a real gem of a tip. Quite often when I am in a lull between projects I will research advanced tips and tricks for MS Excel and MS Word. This one is quite a find. Simple and effective. I appreciate you taking the time to share this and all of the commentary and revisions by the group. Big kudos...
...Matt
Henk said:
Yes, Chris, this is what I had in mind. Now we are in exploration mode, it jumps to mind to make more complicated tricks to analyze and visualize data.
- You can calculate the average score of a data series and use these + / - REPT Chart concept to show the deviations (so instead + / - around zero, you use the same around the average of a data series).
- A second example is to make a so-called Tornado chart. This kind of chart is used for comparing two populations, e.g. responses from women vs response from men, or Europeans versus Americans, etc. It can be done with the Excel bar chart (with some tricks), but with this REPT Chart it goes quicker and for some quick analysis it works wonderful.
- Other symbols may be indicated in particular cases, e.g /// and \\\. Or a solid square, or .. whatever one's creative mind comes up with.
- Colour can be second attribute - e.g., to indicate the topic or product.
The next level is making simple sparklines ?
Chris said:
Jeez, Henk. Yes, yes, yes, and yes. Four more great ideas. I'm not sure I quite grasp the full implications of #1 yet. An example would be?
art steinmetz said:
To Clint's question:"Art, maybe I’m being dense, but can you explain what value is being called by either the M14 or A14 cell reference?"
You're not dense. I'm being a sloppy cut and paster. The only cell reference in the formula should be "A1," the cell containing the value we're graphing. Sorry.
-- art
Henk said:
Chris:
Sorry for not being too clear re #1. Here is the idea.
Suppose you have a list of values, say for simplicity sake the length of all women in your home town. You calculate the average (AVERAGE(A:A), command in Excel), and for each woman you let Excel calculate the difference to this average (Length MINUS Average(list)). These difference values (either pluses or minuses) you plot with this REPT concept (left aligned for the pos values; right aligned for the neg values, in adjacent columns). You now visualize the difference to the average. You can sort of course. Basically it works same as neg/pos related to ZERO - here it is against the average. You can take other pivot values (the mean for instance).
A silly example of course (who wants to know the women's length? the colour of their eyes is far more important!), but I hope it's more clear now.
Chris said:
Henk. You're right, the "zero point" of a positive/negative display need not be zero.
Jon Peltier said:
Henk -
Re Gantt charts, you can also do quick and dirty charts using conditional formatting of cells, which I show (along with simpler stacked bars) here:
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=343
Jon Peltier, Microsoft Excel MVP
http://PeltierTech.com
Luc Betbeder said:
For those of you in a Lotus Notes Or Domino environment the formula is basically the same.
@Repeat("l";NumberField) for a Number Field
and
@Repeat("l";@TextToNumber(TextField)) if a text Field
Format the col as you like.
Robin said:
This is BRILLIANT! I would spend time thanking you but I must now go show off to my colleagues....
Sa, said:
Great Tip, loved this feature
neon said:
Now I will start using Excel again :) Very cool tip. Thank you.
Pranav said:
sweeeeeeeeeeet!
Excel_Geek said:
Very nice. Charting-lite. I completely agree with the "less is more" and "KISS" sentiments above.
Well done.
Excel_er said:
Great stuff! Really simplifies adding a bar chart. Showed your "trick" to my colleagues - they loved. Simplicity wins out every time.
John D said:
Hi,
I'm new to this. I've been using SPSS for these kinds of things. But I like the excel formula. How do you get that vertical "bar" --is it the capital "I" in Arial?
Thanks JD
Zach said:
The "|" key is found when you capitalize the "\" (back-slash) key (at least on my keyboard).
Alfredo said:
This is not just an Excel thing, you can do exactly the same thing in Open Office, which unlike Excel, is free :-)
Paul said:
outstanding tip!!
BTW: lower case 'g' in webdings font makes an "emphatic" solid bar - it's relative to squaring differences for exaggerating the variance. It's only really useful for data with minimal variance. If there is an outlier it's runs off the "page" relative to the other values.
Scott said:
Freaking sweet way to do data.
I'm beta testing office 2007 excel (like Clint metioned above), and they have come up with something like this actually, but have many different options for it. Go to Conditional Formatting, Data Bars, Color Scales or Icon Sets, and that gives you a wide-array of choices.
Thanks for the tip though - I like it a lot and will use it!
Dave said:
The Webdings and Wingdings fonts are great for this. You can create solid bars with Webdings "g" for example. Or you can be more creative and have dots or shapes or whatever. Also, the arrow graphics are good for replicating the Excel 2007 arrows.
James said:
Very very nice excel trick. Thanks so much. I have lots of uses for this!
Laura said:
This is cool. Thanx for sharing.
Masonry said:
HOly shnikeez i am gonna rock my presentaytion tommorow thanks!!
ps- can i use this w/o bein suede?
Anant said:
WOW - this is an awesome tip - very useful for creating mini dashboards - as you mentioned. It's funny, but I had just spent 2 hours struggling with pivot tables to get it to show some data the way I wanted - finally I got frustrated and went to digg.com to take a break and found this!! It solved my problem - I'm using it in conjunction with vlookup to create a dashboard that shows how metrics are changing by fiscal week!!
Thanks
Kevin said:
I'm sure this is not news...but if you want smaller bars...such as when using the webdings trick....click on the font size drop down and manually type in a 6 or 4, etc...and press enter for a smaller font than whats in the drop down selection.
and oh yea...great trick! :-)
Mark Murphy said:
This is great.. I love it.
A few thoughts.
1. to get more accurate spacing on use the background color of the cell to hide some of the missing data. This would allow you to make the the gantt charts easier and the Positive/Negative view could be done in one colum.
Here is the best description I can come up with. Not sure if this will take inlike HTML but here it goes....
||||
||||||||
The first line will show 4 red lines. The second line should show 4 black lines shifted over exactly 4 lines invisible white lines.
2. Creating an addin for this would make it nice. so that is it a function that can either graph a line, or do some comparision between several selected lines.
3. You could also rotate the cell to make it a vertical chart
Keith said:
Very interesting. I'd give it <a href="http://keith.hostmatrix.org/testbed" rel="nofollow">a try later</a>.
Rob van Gelder said:
This reminds me of the In-Cell line-graph I put together some time back:
http://www.dailydoseofexcel.com/archives/2006/02/05/in-cell-charting/
belg4mit said:
Reminds me of http://www.hyperthot.com/pm_excel_gantt.htm or any of the other similar hacks e.g; http://www.mrexcel.com/tip058.shtml
Davidlow said:
I CANNOT WAIT to use this trick the first chance I get and impress the sox off of somebody. Seriously, I can already think of a few sheets I maintain where this would be really handy.
I would have liked to see just one formula demonstrating the conditional formatting technique. Can anyone who knows about conditional formatting maybe post an example here?
Kudzu said:
This is a great tip for integers. Any idea how to tweak it for fractions/decimals? Something like "4.5" is giving me four ticks. I lose the extra "1/2 tick."
silversword said:
Giving away my age but this solution is very similar to how we used to print graphs back in the days of line printers. Excel does, however, offer a lot more options for formatting than a line of x's or dots.
V.Govindan said:
Extremely useful exploration.
Ping said:
Wow..thanks for sharing. That's definitely a helpful one!
JR said:
If you sort the rows on the column that drives the bars, you'll get a "Pareto chart," which has the tallest bars at either the top or the bottom.
This makes it easier to see not only the most frequently occurring items, it also makes it easier to see how quickly the frequencies fall off from the peak.
And if you're trying to compare bars in different columns, it helps to have one column that's ordered. For instance, if the frequencies in two columns are reversed, it'll jump out rather than remain buried in the details.
raypayette said:
I improved the graph by including negative values. Assuming that the Data is in column B, the negative numbrer formulas in column C are:
=IF(B60,REPT("|",B10),"")
Then all you have to do is to justify to the right column C !
Best regards,
Ray Payette
raypayette said:
Missing code:
The positive numbers in column D have this formula:
=IF(B10>0,REPT("|",B10),"")
Best regards,
Ray Payette
www.excelhawk.com
raypayette said:
The negative formula that was incorrectly read is:
=IF(B6
raypayette said:
There is a problem reading the formula.
The positive formula is the same as the negative formula except that the greater than symbol is replaced with the less than symbol.
Best regards,
Ray Payette
www.excelhawk.com
Dick Harriff said:
This is great. I have always wanted to do this sort of thing for probabalistic decision analysis applications. Thanks.
Jaime said:
This is really great! Don't know if anyone would find this useful, but you can also make the bars vertical by formatting the calls so the orientation is 90 degress. I can see using that for final results, although you lose the ability to sort or filter.
xaei said:
Holy wow. I've been searching for this solution for literally months, under excel sparklines, inline charts, etc... and ended up inventing a kludgy method, by basically redundantly creating a grid of values of the same resolution of my desired display, then using conditional formatting on an adjacent grid; i.e. if my data in A1 is 37, i set up 10 cells in a row with formulas of is A1 less than 10, is A1 less than 20, etc..... I only mention this because of its rediculosity.
Thank you.
Do you know of a way to include font size or background color in your 'lightweight data exploration'? any suggestions appreciated.!
Peter van Teeseling said:
great tip ... so simple ... but therefore very powerfull. Should make scanning through long rows of data much easier. Thanks!
Clint said:
xaei, you could use vba to build case statements - this is a generic workaround to the limits on conditional formatting in the current versions of Excel - I bet the Juice guys would be more than happy to discuss writing script-based case statements for this kind of scenario.
right guys? Wink, wink. Nudge, nudge. Know what I mean?
Gary Klass said:
This is great -- it solves a lot of problems with the axis labels on rotated bar charts.
Has anyone figured out how to put a numeric data label on the right hand side?
I was able to do it by copying two columns with the bars and labels from Excel to Word, then converting the table to text with a space separator. But I can't figure out how to do it with just Excel.
rufus said:
Great,
however when I tried it first it did not work. system does not recognize the REPT-function
After I've visiting your site the same code does worked !?
Now again it does not recognize the REPT-function.
I am using the MS OWC 10 pivottable.
Any clue what to do to keep it stable and why this happens? dll's??
Kevin MacHeffner said:
This information is really handy! Thanks for posting the article.
Patrick said:
I have also worked out a Pareto chart...
=IF(F4
Chris said:
rufus: the REPT function works in any modern version of Excel (and most other spreadsheets too). It works in cells, but not pivottable formulas which may be your problem.
Clint: nudge, wink right back. Yes, we need to get around to showing what you can do with simple VBA.
Patrick: Your formula got killed because our comment form eats greater than or less than signs. Can you send me an email with your example at chris.gemignani@juiceanalytics.com
Clint said:
Gary, if you check out the follow up post <a href="http://www.juiceanalytics.com/weblog/?p=239" rel="nofollow">here</a> and download the example file you\'ll see an example of how to append data to the bar chart (essentially using concatenate to build out the bar chart with a data label)
Mario Janin said:
nice tip, it was the old way to have bar graph in Visicalc
http://www.bricklin.com/history/refcard5.htm
Henk said:
rufus: just a hunch. Did you put =before the REPT function? Secondly, you need to put the symbol to be repeated between double quotes. e.g. =REPT(a,5) returns #NAME? but REPT("a",5) produces /aaaaa/.
HTH.
Jonathan said:
One thing i noticed is if you use "|" combined with sub/superscript you get excellent looking tight bars.
Jonathan said:
So sure enough i couldn't duplicate what I just said in another workbook...until i realized you need to drop the zoom to something below 100%...anything sub 100 will give you solid bars when you use sub/superscript. So drop it to 99 if you want all the sizes to remain constant.
Amber said:
How do you caluclate the difference between times when formulating employee time records? For instance: An employee works an 8 hour day in regular hours, and then 3 hours of overtime, which gives him 11 hours total for the day. When I insert 11 hours, I want a formula that will show me 8 hours are regular and 3 are overtime. Can it be done?
Zach said:
Here's one way to do it:
=IF(ref cell<=8,REPT("|",ref cell),REPT("|",8) & REPT("*",ref cell-8))
Amber said:
Thanks for the formula response; I must be doing something wrong. It comes back with an error of an improper formula. I will keep playing around with it, though. I was able to get it to calculate total hours between two times. Maybe I can look for a formula to subtract 8 hours from the original formula that gave me the total hours of 11?....
Tom said:
Here is a slight change to the formula in Mr. Steinmetz' submission which requires a cell defined as MaxAllowed and the cells can then be "left justified" which is the usual default:
=IF(R6>0,REPT(" ",MaxAllowed)&"o"&REPT("|",R6),REPT(" ",MaxAllowed+R6)&REPT("|",-R6)&"o")
Tom said:
Arrrrg, there should only be one space in the first REPT.
Sorry, I must've hit the tab or something!
Jim Cone said:
I first saw this technique in an article by John Walkenbach in the July 1998 issue of PC World magazine. In the article, he attributes the method to a Keith Hermann of Raleigh, North Carolina.
duxxyuk said:
Nice trick.... we say in french Malin :-D
David said:
This works in Google Spreadsheets! An easy way to hack up a graph. (GSS doesn't support graphing yet)
George W Bush said:
What is a spreadsheet again?
Chris said:
George,
Look it up on "the google".
Chris
Steven said:
Great tip! Can't even begin to list the uses for this!
DC said:
You can add something like . . .
=REPT("|",A2/MAX($A$1:$A$9999)*CELL("WIDTH",B2)*3)
. . . so that the chart fills the entire width of column for the maximum value.
(Needs F9 after changes to the column width, it seems)
Chris said:
DC: A great idea, thanks! On the other hand, I wanted to use this technique in my most recent lightbox post and discovered an unpleasant little side effect. Changing any cell width in the spreadsheet set all the CELL results to the width of the most recently changed column. Such are the hazards of Excel development.
Steve said:
Great little tip!
Is there any way to format the "I" colour?
I want a single 'total' bar chart for a ranking, but shown such that you can see the composition from the 3 cells it is a combination of.
i.e. cell '1' in red, cell '2' in blue, cell '3' in black, but all shown as a single total in your one cell graph.
Chris said:
Steve,
You can't have multiple colors of text within a single cell without using Visual Basic. Using different characters (for instance, "\", "|" and "/") _might_ work for what you need.
Chris
gregg said:
If you press down your "ALT" key and type in 219 on your numeric keypad you get the symbol █ whih makes the bar graph looks much more like a bar graph. Albeit a bit larger but I think a bit cooler
Risks versus Rewards Worksheet - lifehack.org said:
[...] As an example, let say you’re trying to decide whether to go skiing this weekend. You’d begin by listing the rewards - such as fun, seeing friends, etc. - along with a weight on a scale from 0-5 on the importance of each reward. Next you’d list the risks - you can’t ski, breaking something, death, etc. - and the weight of each risk. The worksheet uses a simple calculation to determine the outcome, and displays a message along with a simple bar graph of the results. [...]
Excel in-cell graphing » xambezi said:
[...] Add visual eye candy to your Excel spreadsheets (workbooks, whatever) with an elegant bar chart technique from Juice Analytics. In addition to the basic bar chart and dashboard described in the initial post, they follow up with more styles, positive/negative and Gantt chart variations, and a downloadable spreadsheet with all of the examples. [...]
Balkengrafik direkt in Excel-Zellen ausgeben — Software Guide said:
[...] Weitere Informationen siehe unter Lightweight data exploration in Excel und More on Excel in-cell graphing, außerdem gibt es eine Excel-Datei zum Download. [...]
Alex Skarulis said:
The concept of text sized graphics was made popular by Edward Tufte. He coined these "sparklines". A company called Bissantz created several add-ons for excel (and MS Office in general) which create very beautiful text size graphics. http://www.bissantz.de/sparklines/ There are several versions ranging from "pro" to "free". Biggest downside I see to this approach is that it loads/requires some special fonts. Meaning, if you forward your spreadsheet to a colleague who doesn't have the sparklines add-on, it won't display as intended.
Also, I loved the comment suggesting the use of a calculation to gauge the width of the cell to make the width of the graph scale appropriately. An alternate suggestion would be to determine max width desired manually (I find a rept of 50 using font 10-Stencil to be satisfactory). Then in the formula, we simply find the max value of the range being graphed and divide each graphed value by the max value and then multiply by 50.
=REPT("|",A2/MAX($A$2:$A$20)*50)
Note: Above formula is for a graph in cell B2, where value being graphed is A2 and range of values being graphed is A2 through A20. The formula is then copied from B2 and pasted to cells B3 through B20. Change the 50 at the end of the formula to adjust max width.
David Bernier said:
With regards to Henk's tip,
You can concatenate the "charted" figure to the bar chart with the & operator
assuming that data is in cell A21
negative side (E21): =IF(A210,REPT("|",A21)&" "&A21,"")
thecourtsofchaos » Blog Archive » Visualisation Presentation said:
[...] Lightweight Data Visualisation in Excel Not all data visualisations need to be complex. This technique for Excel creates easily comparable data using only conditional formatting and a simple command to repeat characters. [...]
Un par de trucos interesantes de Excel « Esta es la de Diego said:
[...] 2. Gráficos de barras en la propias celdas [...]
Book Review: Killer Flagship Content « Faithful Web said:
[...] The Juice Analytics spreadsheet for effective graphical display in Excel [...]
Juankar en Estado Puro » Un par de trucos para Excel said:
[...] 2. Gráficos de barras en la propias celdas [...]
Yogi Anand said:
Visual Representation of Data
GREAT ...! Bar Graphs with characters such as the | character or -, *,^,, ... can make for very meaningful presentation of data. I recall doing this for the first time with +/- characters in Lotus or AppleWorks even before the charting capability was made available in those programs. I have implemented positive and negative representation by putting positive data to the right and negative data to the left. Use of Conditional Formatting of the data to show positive and negative data, or data larger or smaller than a certain amount, such as a quoted price, set sales quota, etc., in different colors, can be very meaningfuld visually.
I found the discussion in this weblog very interesting and very meaningful. Enough chatting, now back to the drawing board.
Yogi Anand, D.Eng, P.E.
Energy Efficient Building Network LLC
http://www.energyefficientbuild.com
Mir said:
This is a spectacular tip! thanks!
Dan said:
I'm having a hard time getting the bars to work with negative values. Can somebody please email me the correct formula. To help things along, my negative value is in cell H41. Thanks..
email: daniglesmythe@gmail.com
Yogi Anand said:
Hi Dan:
I just saw your post -- sorry about such a long delay in writing back.
If my numeric value (positive or negative) would be in cell H41, then I can use the following formula in cell I41
=REPT($I$1",IF(COLUMNS($A:A)=1,MAX(0,-$H41),MAX(0,$H41)))
to get my character graph for negative values.
Then I drag the formula in cell I41 to cell J41 to get the character graph for positive values.
In the above formulas cell $I$1 houses the character that I want to use in making my in-cell graphs in cells I41 and J41 for numeric values in cell H41. The character in cell $I$1 can be '|' (the pipe character) or for that matter any character with your desired font, color, and alignment to suit your fancy.
Let me know how it goes. If it will help I can post a sample spreadsheet on http://spreadsheets.google.com
Yogi Anand, D.Eng, P.E.
Energy Efficient Building Network LLC
http://www.energyefficientbuild.com
Daniel said:
HEy, that really neat!
I love this trick!!
Lydia said:
I'm so excited! This helped me figure out how to do a tornado graph for a simple list of data: insert a column for ABS values, sort the data to be graphed by the ABS column and then do the REPT process for the neg and pos numbers as described above. Thanks so much!
Leigh said:
Wooo hooo .... just love this one. I'm off to play with all the variations - thanks! :0)
Ben Langleben said:
what a simple and brilliant adaptation of a built-in command!
frank said:
this is a great feature, kick butt! i can't believe i didn't know about this one.
Gaetan said:
Thanks a lot for this topîc and all the comments
I made a summary (in french) there :
http://www.xlerateur.com/?p=137
and the related excel file :
http://www.polykromy.com/nl/nl74/reporting.xls
kanwaljit said:
I am using Excel since three years. And this is one of the most amazing things I came to know. Kudos to the writer.
Kanwaljit
Juan Carlos Mendez said:
Two improvements over the technique described here: better resolution and solid-looking bars that show better at different font sizes.
If your values are integers in a range 0-9 or so, you can use the REPT formula as presented there, and perhaps you like the dashed type bars, so the formula as shown would work perfectly for you. If not, keep reading.
For larger values, when you reduce them to a 0-9 range by dividing by a factor, you can use the decimal part to show a half character, having effectively 20 steps on your bars, instead of just 10 you would get with the simple “|” character. The trick is to use unicode character 0×2588 (dec 9608) that will show a full block, and character 0×258c (dec 9612)that will show a half vertical block.
To get those unicodes you can hold and press the Alt key (Windows PCs), then type 09608 or 09612on the numeric keypad, then release the Alt key. For most, this should work with the default input methos. Unfortunately this method is not universal and depends on selected settings and input methods. You can just go to a Excel cell, choose the menu “Insert->Symbol” and type 2588 or 258c on the box at the bottom reading “Character code”
Finally the formula to use is
=REPT("█",TRUNC(C49/scale))&IF(MOD(C49/scale,1)>0,"▌","")
For more details, check my post at http://jcandkimmita.info/jc/2007/07/business/tools-methodologies/yet-another-in-cell-excel-bar-chart-technique/
derek said:
Anyone know how I can get Lotus Domino to produce lightweight bars only on the Totals rows of a view? I have a count column that is simply the number 1, hidden for detail rows, and displayed for all subtotals. I would like bars to go with this, but only for the subtotals, not for the detail rows.
Luc Betbeder commented at #34:
<i>For those of you in a Lotus Notes Or Domino environment the formula is basically the same.
@Repeat("l";NumberField) for a Number Field</i>
Hugo said:
Wow, this is a great teip. THX!
Hugo said:
...or should I have said "tip"...anyway, good job!
BillyG said:
I don't use Office products for anything (with the occasional exception of Word), but this was so awesome, I had to stop for quickie: Nice!
fyi: I can't see the right side of this textarea box, hope you get legible words.
Bjarne said:
I work a lot with Excel, mainly in order to manage data - often with very complex sets of formulas... and this tip is really a good addition to my toolbox of tricks.
John said:
Cool find, nice tip.
Ffanatic said:
This is an awesome tip, but for some reason, I can't get my bars to "sort" into decending order for a pareto chart. For some strange reason, when I select the rows, and try and sort them, the values change, and some bars do not display.
here is an example of the format for my rows:
=IF(J33=0,"",REPT("|",J33/10)&" "&J33)
when sorting, some of the actual cell values (ie J33) change to some other value...say J31, which totally screws things up.
Frank said:
How do I set up excel to automatically line graph the preceeding 12 months of data. I have a spreadsheet which needs to graph 50 charts (rows)of data every month
Az said:
Excellent tip. Thanks for sharing...
Adam Szecowka said:
Hi Guys
Thanks for such a useful Tip. What I would like to know is if there is a way I can make the width of these bars the same as the cell, without changing the font size. Keep up the fab work!!!
Excel Dashboards said:
Thanks for the nice tip.
Alan said:
I liked the idea of having both neg and pos values in a single column. I used the Fixedsys font to get a monospace look and feel.
I developed this very cumbersome formula. It works, but perhaps someone here could find a simpler approach.
Basically, I padded the spaces to the left so that the "o" charater would define the bulk of the data with the "|" becoming the centerline. To pad the cells properly, I had to find the minimum value for the entire region of data.
I was using the rand() function to test this and had some rounding problems that prevented alignment, so I used the round() function several times. As I said, it looks unweildy, but it works.
Here is a sample assuming the data is in cell B2 and assuming that all data is input in cells B2 through B7.
=iF(B2<0,REPT(" ",IF(MIN(B$2:B$7)<0,ROUND(-MIN(B$2:B$7)+ROUND(B2,0),0),ROUND(MIN(B$2:B$7),0)))&REPT("o",ROUND(-B2,0))&"|",REPT(" ",IF(MIN(B$2:B$7)<0,ROUND(-MIN(B$2:B$7),0),ROUND(MIN(B$2:B$7),0)) )&"|"&REPT("o",B2))
See what you think.
Alan
Klemen said:
Thank you Alan, great job!
Harry said:
Any pointers to data-manipulation tools/methods when the data isn't numeric? I am trying to support some folks who are trying to leverage Excel as a "database"....
ARS said:
I simplified your approach. Requires 2 columns but gives you the ability to have red and green text for the negative and positive values.
Left column right justified.
=IF(B3<0,REPT("o",-B3),"")
Right column left justified.
=IF($B3>0,REPT("o",$B3),"")
Warren said:
That's a great little tip.
Thanks!
Tom said:
I realize this blog is almost three years old, but I had a question on formatting the single bars...("When formatted in 8 point Arial font, single bars look like bar graphs.")
I can't get the single bars to look like one solid bar unless I get the font down to 4 point (which is really small). And even then, if I zoom in on the spreadsheet (to, say, 150%) they go back to single bars.
Am I doing something wrong, or does it just depend on your screen settings as far as when the single bars become one solid bar?
friend said:
In excel, go to Insert-->Symbol. Scroll through the list until you find the solid black rectangle symbol. click on insert and it will insert into a blank cell. Copy this symbol and paste it into the formula REPT("symbol",B3) as an example. You can change the font color to make it a different color. This makes a solid bar. Hope this helps!
Peter said:
this is awesome! many thanks!
Drifter said:
This is Great!
Thanks!
Dinesh K Takyar said:
Impressive. Well explained.
http://www.familycomputerclub.com
GAC said:
Excellent. Very good and simple tool.
GAC from Chile
Clint Meyer said:
PLEASE explain how in the last picture you are able to change the color of the pipe symbols based on its value in a range. I have played with the conditional formatting gui, asked the local "experts", and googled it but cant seem to find an answer. Is the only solution to use VB?
Thanks for this bit of awesomeness and any help you can give me.
Sal Uryasev said:
Hey Clint,
Go down to 'Create Coloured Shapes' on this page: http://www.contextures.com/xlcondformat03.html
More advanced excel users may also be able to substitute the absolute numbers with some formula based upon the max and min of a range to make it fully automatic.
Clint Meyer said:
Sal
Thanks, so simple!! Why did that escape me?
Alex Kerin said:
I know this is an older post, but I found that if you use the "Script" font, its spacing is so small the bars appear solid. You will likely have to fudge the multiplication of the REPT to get a suitable length.
fullo said:
wingdings gives a good solid square to use with this.
Cat said:
I've been using "g" on the webdings font which gives a solid bar !
Rayan Jawad said:
Brillint!
Andrew said:
Unicode characters (eg in Lucida Sans Unicode - as installed on my machine here) have filled boxes in 1/8th increments (in the Block Elements section) if you want to go down to that level... (changes the formula to one with two sections: use div and mod to get the count of full boxes and 1/8ths respectively)
Mark said:
At 100% zoom try Arial Narrow at 8pt and the following formula: =CONCATENATE(REPT("|",C6/20)," ",C6) change the params to your requirements - the 'C6' at the end puts the value of the cell at the end of the bar.
What I would like to know is how to use and Alt+code in the function - anyone?
KevM said:
Mark - to use the Alt+ code, just use the CHAR(n) function, e.g. =REPT(CHAR(65),A1)
ward said:
We've built a handy low-cost alternative to loading and pivoting it.
Together with what you've described above, it would be more than a lightweight form of data analysis. See http://www.nextanalytics.com
Prashant said:
instead of I use G and change the font to webdings.... this will create bar chart effect on excel within the table...
You can also explore rotating the text to 90% and the bars will become vertical... within the table.
adam said:
Excel 2010 has a feature called sparklines that also accomplishes this in a simple fashion.
said:
Add a comment