Welcome to MSDN Blogs Sign in | Join | Help

Microsoft Excel

The team blog for Microsoft Excel and Excel Services.
Conditional Formatting Trick 3 – The percentmin Property

Folks that have been using data bars (see here for more information) in Excel 2007 sometimes bump into a situation where the size of the bar painted by Excel on the smallest value in the dataset seems too big.  An example will probably help.  Take a look at this fake data and accompanying data bars:


The size of the data bar for the last value – 170 – is too big given the relative size of 170 to the other numbers in the range (hundreds of thousands).  Why would that be – the data bar should technically be 0 pixels wide?  The answer is that when we were doing usability testing of this area in Excel, we found that users preferred not to see blank data bars, so Excel’s default was set to a 10% minimum width.  While there is no UI to tweak that setting, there is an OM property – percentmin – that you can use to set the minimum width to whatever you like.  Accordingly, if I select the range, open VBE and type “activecell.formatconditions(1).percentmin = 1” in the immediate window, I see this:


There are probably other interesting uses for this property … for example, I have seen someone write a bit of VBA to always make sure there was at least one pixel showing in this sort of situation, but the threshold was dynamic, not set to a fixed value like 10%.

Posted: Wednesday, September 20, 2006 9:09 AM by David Gainer

Comments

John Drummond said:

I wonder what other people would say about this - I rather think the 10% limit is a flaw, I can think of clients of mine who would not use DataBars for this reason - they just would not be able to cope with a graph thats basically wrong, and not being able to change it through the UI makes it impossible to produce graph thats reliably accurate.  Would a one pixel line not be possible, or perhaps an option somewhere in the UI?  I hope I'm not having a nit-picky kind of day, but I think this needs another look at.
# September 21, 2006 5:50 AM

spursfan56 said:

No, I'm with you John - no bar or an arbitrary 10% are just plain wrong - the least bad choice would be a fixed 1 pixel as you suggest
# September 21, 2006 7:34 AM

Sebastien Caisse said:

I would have liked to also be able to set a single solid color instead of a gradiant since it can be hard to see where the fading ends...
# September 21, 2006 8:59 AM

A User said:

Please reconsider.  Sometimes what a majority of users perfer as a matter of apearences is inconsequential.  Sometimes you just have to have the integrity to stand for truth.  This choice is literally wrong, and makes the feature and product untrustworthy.

Make the bars accurate by default, and provide a UI for people who just want pretty pictures instead of accurate information.

"Round numbers are always false."
# September 21, 2006 1:15 PM

David Gainer said:

Thanks for the feedback.  I will talk to the team.
# September 21, 2006 3:43 PM

Francis said:

This is precisely the kind of tweak that I only discover after searching newsgroups! I doubt most people have either the inclination or the leisure to do so.

I always wondered why previous versions of Excel hid chart element dimensions from users--and why there is still no obvious way toggle automatic layout in Excel charts. Or why "distributed" alignment can only be accessed by CTRL+SHIFT+J in Word. (It's not in the Paragraph dialog.)
# September 21, 2006 4:56 PM

SteveA said:

I was excited about data-bars when I read about them, but when I tried them in the beta I thought this 10% offset was a bug rather than a feature.
Excel is about accuracy so having this 10% offset is just not accurate. As Mr Spock would say, " illogical captain".

Dave, please make sure your team do reconsider.
# September 22, 2006 3:51 AM

Zach Gemignani said:

Are there other decisions on data presentation that were made with this particular user testing group? I'm concerned that you may be falling into the New Coke sweeter-is-better-the-first-time-but-eventually -it-makes-you-want-to-vomit trap. When we all have to end up living with this tool, we'll appreciate straightforward displays that show actual values and don't both with the window-dressing of gradients.
# September 23, 2006 10:08 AM

Chris Gemignani said:

David, I'm glad to hear you're taking this back to the team. Misrepresenting data by default is like shipping Excel with broken statistical functions--it's something that should never have been considered. It's discouraging that user testing is used to justify this.

The gradients are a problem too. They make it hard to tell where the bar ends. Long bars have quite a bit of their length in hard to see gradient. This skews the results toward making the short bars appear more consequential.

Check out: http://www.juiceanalytics.com/weblog/?p=239 for a discussion of how data bars can be done in an easier to read, lower tech way. I think folks are justifiably excited about the potential of data bars, so I hope you get them right.
# September 23, 2006 10:18 AM

Andy said:

An option to turn off the 10% easily, is needed to make it easier for the user.
# September 24, 2006 5:50 AM

Bob Umlas said:

If I add another cell with 170 (so I have two cells with 170) and use the command you suggested:
activecell.FormatConditions(1).percentmin=1
then the display seems to affect BOTH 170's, not just the activecell, as the VBA would imply. It this correct?
# September 25, 2006 2:55 PM

David Gainer said:

Bob - it does appear to set the PercentMin for the whole rule, not just the activecell, which makes sense in one respect but which isn't really clear.  I would expect people that are doing this to be working with someting other than the activecell object though.
# September 26, 2006 1:24 AM

DBM Forum » Blog Archive » Excel 2007 spielerei said:

# December 24, 2006 5:13 PM
New Comments to this post are disabled
Page view tracker