Welcome to MSDN Blogs Sign in | Join | Help

Conditional Formatting – overview of what we did, and what’s a “data bar”?

Conditional Formatting is a feature that allows users to apply formatting to cell(s) automatically depending on the value of the cell or the value of a formula.  This is a handy feature, making it easy to highlight certain values (“all test scores below 50% turn red”), or make particular cells easy to identify (“all the tasks assigned to Dave turn green”).  It is also a powerful feature, given that conditions can be based on any Excel formula.  Users that know about the feature love it, and many book chapters and articles and web pages have been written on how to do all sorts of creative things with the feature.  In our research and planning for Excel 12, it became clear that there was still a lot of additional capability that we could add in this area that would benefit all sorts of users, so we set out to really improve the feature in a number of ways.  Specifically, we set out to:

  • Make the feature easier.  We wanted to make it much easier for users to find the feature, to add conditional formats to their work, and to remove them too.
  • Make more possible without needing to write formulas.  We wanted users to be able to set up conditions like “top 10%” and “duplicates” with just one click. 
  • Provide new “visualizations”.  We wanted to provide users with new visualizations for the purposes of exploring large data sets, identifying trends and exceptions, and quickly comparing data.  We also wanted our new visualizations to be useful for annotation and presentation purposes. 
  • Address top customer requests.  Many, many users have asked for more than three conditions, better UI to be able to reorder rules, etc., so we wanted to address those requests. 
  • Provide a better experience in PivotTables.  We saw an opportunity for conditional formatting to “do the right thing” when applied to PivotTables.  For example, it should be easy to apply a conditional format to an entire level and have new values that show up inherit that format, behave sensibly when users pivot, sort, or expand/collapse, and so on. 
  • Provide a better experience in Tables. Tables are a new feature in Excel 12 that I will cover more in a few weeks, but suffice to say that they have structure and conditional formatting takes advantage of the structure to help the user set up useful conditional formatting rules. For example, you can create a conditional formatting rule to compare two columns in a table or, based on a condition, format the entire row if needed.

These goals translated in to the following work:

  • Three new visualizations – “data bars”, “colour scales”, and “icon sets” (note – these are working names, not final names) 
  • New UI for adding, removing, and managing conditional formats 
  • New conditional formatting “rules” 
  • Increased “limits” (see previous posts) and other customer requests 
  • Some PivotTable-specific functionality 
  • Some Table-specific functionality

Over the next week or two, I am going to review this work in detail.  For the rest of this post, let’s explore one of the new visualizations – data bars.  As I mentioned above, we wanted to provide users with great new data visualization tools so that users could scan and quickly comprehend large quantities of information – see outliers, spot trends, compare values, etc.  In the case of data bars, the specific goal was to allow a user to select a range of cells and with one click apply a conditional format that makes it easy to see the value of a cell relative to all other cells that have been selected.  Say, for example, that you had this range of data, and you wanted to make it easy to spot the large numbers and small numbers:


(Click to enlarge)

If you select that range and apply data bars, the range now looks like this:


(Click to enlarge)

… which makes it pretty easy to see the large and small numbers (note – I have kept the sample range small for illustrative purposes … the bigger the range, the more data bars help).  So what’s going on here?  Excel is comparing the values in each of the selected cells, and drawing a data bar in each cell representing the value of that cell relative to the other cells in the selected range.  This bar provides a clear visual cue for users, making it easy to pick out larger and smaller values in a range.  By default, when you apply data bars with one click, Excel uses the highest and the lowest value in the range to draw the shortest and longest bar.  You can see how this works when I change the first two cells to have higher values (19k and 15k respectively):


(Click to enlarge)

The bars in all the cells adjust accordingly – as with all other conditional formatting, data bars are re-applied after calculation or data refresh, so the user always sees an accurate picture of their data set.

Of course, many times you might not want to use the minimum and maximum values in a range … accordingly; we have made all of this quite configurable.  Here is a shot of part of the dialog that lets you change the settings on a set of data bars (warning – not final UI, for illustrative purposes only):


(Click to see list)

Besides the colour of the data bar, for both the shortest bar and the longest bar, you can specify “lowest/highest value”, “number”, “percent”, “percentile”, or “formula”.

  • For "lowest/highest value," Excel evaluates all of the values in the range of cells and selects the lowest value as the shortest bar and the highest value as the longest bar. 
  • For "number," the user enters the value that should receive the shortest and longest bars.  For numbers that are more or less than that value, Excel simply draws the shortest or longest bar as is appropriate. 
  • For “percent”, the user enters a percent to associate with the shortest and longest bars.  For example, if the values in the selected cells range from 0 to 200, then a minimum value associated with "25%" would be 50.  In this example, any cells having values less than 50 would have the shortest bar drawn in the cell. 
  • "Percentile" differs from "percent" in that it doesn't determine percentages within the range of values.  Rather, "percentile" examines the set of values contained in the cells, orders them, and uses their ordinality or position within the set of ordered values to determine their percentile.  In a set of ten ordered cells, the 40th percentile would always be the fourth cell, regardless of the value contained within it.  Ergo, if a user selects "percentile" and enters 40 for shortest bar, then the cell(s) at the 40th percentile and below would have the shortest bar drawn in the cell.
  • Finally, "formula" allows a user to enter a formula.  The formula is evaluated to determine the value used for shortest and longest bar.  This is useful for developing conditional formats that aren’t easily handled by the proceeding 4 choices.

Before I wrap up, I wanted to make sure that I pointed out two things that are fundamentally different from other conditional formats.  First, unlike other conditional formats, which evaluate to true or false on a cell-by-cell basis, this conditional format is a comparison between a set of cells.  Second, data bars provide an entirely new visual effect – a bar drawn inside a cell.  These two differences also feature in some of our other visualizations, so I wanted to make sure I called the differences out clearly.  Next up, "colour scales".

Published Tuesday, October 04, 2005 11:05 PM by David Gainer

Comments

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Wednesday, October 05, 2005 2:59 AM by sn
Are you English or from one of the Commonwealth countries? I noticed you said "colour scales" not "color scales" :)

Love the feature. Will Office 12 B1 be available broadly? Or atleast freely within Microsoft? Where can I go to register for B1 within the company?

Thanks. I am a huge Excel user and fan. I really appreciate the blog and your team taking the time to post to it.

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Wednesday, October 05, 2005 3:09 AM by Step
Awesome! I've been wanting improvements to Conditional Formatting for a while - very exciting! I can see uses for the data bars, but I'm really looking forward to seeing what you've done with the "regular" Conditional Formatting dialog.

You guys really seem to have outdone yourselves on this release. Looking forward to B1.

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Wednesday, October 05, 2005 5:42 AM by anon

The real kicker would be that the data bar is only a working sample of a more general approach to visual widgetry.

My question is, how does this component relate to IGX?

I see a number of ISVs willing to either write such XML-controlled widgets and/or migrate arbitrary ActiveX to this. Your thoughts?

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Wednesday, October 05, 2005 6:53 AM by chad
One item in conditional formatting that I've always desired is the ability to hide (or not print) rows/columns using conditional formatting. For example, if a row has all zeros in it, conditional formatting would either hide the row or it wouldn't be printed.

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Wednesday, October 05, 2005 7:49 AM by Marcos Martins
Good features!!

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Wednesday, October 05, 2005 8:46 AM by Charles
Office 12 looks very impressive: I guess you must have started working on it way before Office 2003 shipped.

Bars look great, but whats the performance hit like when Excel has to do the comparisons on a large column?

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Wednesday, October 05, 2005 8:55 AM by Helen
This looks great and will be a very useful feature. Now I'm really looking forward to the new version!

# Conditional Formatting Reference in Forumulas?

Wednesday, October 05, 2005 9:52 AM by Tianwei
David, thanks for the detailed postings. I am getting more excited about Excel 12 every day now.

Quick question: one of the things I have longed for over the years is the ability to reference a format (colors, patterns, etc) in a formula. Case in point, you have a detailed page of all data and conditional formatted cells. Then you create a summary page where you would like to say: if the cell in detail page is formatted like (ref to a "hard formatted" cell) then retrieve the value. Would there be such a feature in Excel 12?

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Wednesday, October 05, 2005 12:31 PM by Andrew
Hi David,

These new features look like they will benefit a lot of users.

I just had a shot at doing something similar for earlier Excel versions.

http://blog.livedoor.jp/andrewe/archives/50066157.html

Not quite as good as though ;-)

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Wednesday, October 05, 2005 12:47 PM by XL-Dennis
Very nice and it seems that we can replace all the workarounds we now use with built-in features.

Will we also be able to fully access C/F via VBA?

Kind regards,
Dennis

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Wednesday, October 05, 2005 1:38 PM by Erik Svensen
Great feature ... can't wait to implement this in my Excel solutions :-)

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Wednesday, October 05, 2005 1:48 PM by Colin Banfield
Very nice feature indeed! The in-cell visualization may make it easy to create, say, a project Gantt chart in Excel.

Colin

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Wednesday, October 05, 2005 3:30 PM by Rob van Gelder
Chad,

What you require is conditional number formatting - a feature which does not exist (yet?)
eg.
=0 then NumberFormat = ;;;

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Wednesday, October 05, 2005 9:51 PM by Jon Peltier
David -

Two weeks ago I build a VBA procedure to draw rectangles in a column of cells to compare values visually. Last week I saw my technique built into the new CF, demo'd at the MVP Summit. This is way cool, and the new Excel is going to rock.

- Jon

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Wednesday, October 05, 2005 9:52 PM by Jon Peltier
Rob -

The =0 part of the number format is between the second and third semicolons. But you knew that.

- Jon

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Wednesday, October 05, 2005 10:17 PM by Pete Wall
I don't get overly excited by conditional formatting though it certainly has its uses.

A bit like Tianwei wrote, the feature would be useful if one could filter ("directly")on the conditional formats. Without that capability, the conditional formating is to me only doing part of what I need. A list of say 10,000 items and 50 of them highlighted by conditional format is not much help, IMO, if I can't readily filter to (de)select them. This is obviously not related to data bars, which are the subject of the post. So, maybe it will be addressed in future articles?

regards

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Thursday, October 06, 2005 1:02 AM by Biff
This seems like a nice feature and judging by the comments, greatly anticipated.

Just a thought.....

Place the numeric value "inside" the color bar.

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Thursday, October 06, 2005 1:49 AM by David Gainer
Howdy,

sn, Step, Marcos, Helen, and everyone else – Glad you like what you see.

Anon – IGX is a separate diagramming component. Also, the idea of ISVs writing other visualizations is interesting, although in this release, they will have to rely on the Excel object model.

Chad – We didn’t address that specific scenario in our conditional formatting work this time out.

Charles – Performance is always something we test and spend a lot of time on in order to make sure it is acceptable. Specifics depend on the amount of data you are using, the machine specs, etc.

Tianwei – No, we haven’t done any work to enable referencing formats in formulas. In Excel, formatting is applied after calculation, so there would be the danger of conditional formats changing after calculation.

Andrew – Thanks for the link.

XL-Dennis – Absolutely – the new conditional formatting features will have a full VBA object model.

Rob – That is a great idea, but not one we have implemented in Excel 12. What kind of scenarios would you use that for?

Pete – You will be able to filter by formatting, conditional and otherwise, in Excel 12. That will be the subject of some posts later this fall. We have a lot to talk about this release!

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Thursday, October 06, 2005 1:51 AM by David Gainer
Biff - thanks for the idea. With cell alignment and column width, you may be able to get the value inside the bar.

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Thursday, October 06, 2005 10:32 AM by Chris Rae
Good afternoon, Mr Gainer -

One thing I've noticed with these new conditional formats is that the "scope" of the format now matters much more. While it's always been a little tricky to tell how far your conditional number formatting extended, it now makes quite a difference if you format A1:A10 to show data bars, and then independently format A11:A20 to do the same. The numeric ranges the bars pertain to are now different for what appears to be a contiguous range. Is there any possibility we could have even a hotkey (much like Ctrl-/ for array formulas) to show the region that this particular bar format covered?

Chris

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Thursday, October 06, 2005 2:12 PM by David Gainer
Chris - at the moment, we don't (though we have made it easier to select conditional formats from the ribbon), but that is a great idea.

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Friday, October 07, 2005 7:49 AM by mschaef
Here's another approach to doing something similar in 'legacy' Excel. This technique uses the old line art characters from the original IBM PC.

http://www.mschaef.com/cgi-bin/blosxom.cgi/tech/excel/databar.txt

One question I have about the "Real McCoy" in Excel 12: will it be possible to have bars that progress to the left, as well as bars that progress to the right? It'd be nice to be able to use this feature to do things similar to this:

http://www.czso.cz/kraje/roc/data2004/13310104/data/grafy/graf08.gif

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Friday, October 07, 2005 9:38 PM by Jean Martineau
Very excited . I am also hurry to see new features for pivot table. I am looking to see calculated items from a previous field item. This would be very practical for MPS: StartingInventory = EndInventory of the previous period and EndInventory is a calculated item. See examples at
http://www.apics.org/Resources/Magazine/Current/SalesForecast.htm

# Sparklines?

Tuesday, October 11, 2005 3:09 PM by Adam S
This is a really cool looking feature. What about having sparklines (miniature graphs) that could either be in a cell, or quickly generate a cell-sized line graph of a column or row?

# re: Conditional Formatting – overview of what we did, and what’s a “data bar”?

Monday, October 17, 2005 3:45 AM by Vic Eldridge
I notice that when you specify a number for the shortest/longest bars, if the actual data falls outside those limits, Excel will just draw either the shortest or longest bar. I think that could be dangerously misleading in certain situations. Perhaps arrowheads could be used to indicate when the data is off-scale. A lot of people might say "set it up using the Highest/Lowest value option". The trouble with that is when the data varies by orders of magnitude, you quickly run out of pixels to display the smaller values. Also with regards to Data Bars, I'm interested to know how you're going to handle negative values. Is the zero point going to be somewhere in the middle of the column, with negative values to the left of zero and positive values to the right ?

Also, I must congratulate you and the team for the work you've done. I have to admit I was beginning to think that >256 columns was >Microsoft but I'm glad to say you've proved me wrong. I'm just itching to get my hands on it !


Regards,
Vic Eldridge

# Conditional Formatting Trick 1 – Mulit-Coloured Data Bars

Friday, February 24, 2006 4:50 PM by Microsoft Excel 12
A few months ago, I described the new features we have added to Excel 2007 in the area of conditional...

# Data Bars and DataGridView

Sunday, March 19, 2006 5:21 PM by Mabsterama
A lot of people out there will by now have seen the screenshots of Excel 12 (now Excel 2007) and its...

# Tables Part 2: Stickiness, Structured Selection, And More

Friday, January 26, 2007 8:02 PM by Microsoft Excel 2007 (nee Excel 12)

One of the key benefits of tables is how other features in Excel 12 behave more predictably and more

# Excel's new gradient Data Bar feature is cool: you can do it too!

Thursday, September 27, 2007 8:43 PM by Calvin Hsia's WebLog

I’ve seen demos of Excel 12 and it’s conditional formatting Data Bar and thought it was cool. In each

# conditional formatting in excel

Sunday, May 25, 2008 2:07 AM by conditional formatting in excel

# conditional formatting in excel

Sunday, May 25, 2008 2:07 AM by conditional formatting in excel

# excel conditional formatting

Saturday, June 28, 2008 5:47 PM by excel conditional formatting

# excel conditional formatting to sort

Saturday, June 28, 2008 6:05 PM by excel conditional formatting to sort

# excel conditional formatting to sort

Saturday, June 28, 2008 8:15 PM by excel conditional formatting to sort

# Excel Roundup 1

Thursday, August 14, 2008 2:42 PM by Excel Roundup 1
New Comments to this post are disabled
 
Page view tracker