Welcome to MSDN Blogs Sign in | Join | Help

Microsoft Excel

The team blog for Microsoft Excel and Excel Services.
More about conditional formatting ...

Another goal that we had for conditional formatting was to address top customer requests, like more than three conditions, the ability to reorder conditions, and the ability to have more than one condition resolve true.  Let’s take a look at some of the more advanced conditional formatting UI and how it allows us to address those customer requests (again, UI is not final).  First, let’s look at the “Conditional Formatting Rules Legend” dialog:


The Conditional Formatting Rules Legend dialog is the one-stop place to view and manage all the conditional formats in a workbook. Using this dialog, you can:

  • View existing rules – you can view the rule condition, the range it is applied to, and the format set on the rule. The ‘Show Formatting Rules for’ dropdown at the top of the dialog allows you to change the scope of the rules you are looking at.  You can view rules for the selected cells, the current worksheet, the current Table, other worksheets in the book, other Tables in the workbook, or the entire workbook.
  • Add new rules via the New Rule button. More on this below.
  • Change the order in which rules are evaluated. This is done using the up and down arrow buttons.
  • Edit existing rules via the Edit Rule button. The Edit Rule UI is the same as the "New Rule" UI explained below.
  • Delete rules via the Delete Rule button.
  • Control whether more than one Rule can evaluate to true.  More on this below.

When you press New Rule on the Conditional Formatting Rules Legend dialog, or when you select More Options … from the conditional formatting gallery fly-outs, you will see the “New Rule” dialog:


This dialog allows you to add new conditional formats to the selected range. Through this UI, you can add all the conditional formats that are available through the ribbon as well as a set of additional, slightly more sophisticated conditional formats.  In addition, you can change the different settings and parameters on any conditional format.  We have broken down our conditional formats into a few categories which are listed in the top of the New Rule dialog under “Select a Rule Type”. The bottom part of the dialog contains the Rule Description which changes based on the rule type selected above.  Here is a summary of the categories:

  • Format all cells based on their values – Use this to create a data bar, 2-color or 3-color color scale, or icon set rule.
  • Format only cells that contain…  – Use this to create the Excel 2003-style rules and more (format cells greater than, less than, greater than or equal to, less than or equal to, equal to, not equal to, between, not between). This is also the entry point to create rules of type: specific text, date occurring, blanks, non-blanks, errors, non-errors.
  • Format only top or bottom ranked values – Use this to create top n, top n%, bottom n, bottom n% rule types.
  • Format only values that are above or below average  – Use this to create above average, below average, 1 or 2 or 3 standard deviation above, or 1 or 2 or 3 standard deviation below rule types.
  • Format only unique or duplicate values – Use this to create rules that format unique or duplicate values.
  • Use a formula to determine which cells to format – Use this to create Excel 2003-style rules where you can enter a formula to determine whether a format should be applied.

Finally, as I touched on briefly in one of my initial posts, we have also made some significant improvements in the infrastructure of conditional formatting based on top customer requests. We changed the following in Excel 12:

  • Number of conditions on a range is no longer limited by number.  In Excel 2003, you could create conditional formatting rules with 3 conditions. Now, you are no longer limited by number; you are only limited by system memory.
  • Multiple conditions evaluating to true.  In Excel 2003, there could only be one conditional format applied to a given cell.  If more than one conditional format evaluated to true, then only the format associated with the first conditional format was applied.  We now allow you to have multiple conditional formats on a cell applied if more than one condition evaluates to true. For example, assume you have one conditional format that makes font style bold when true, and another that makes the cell background colour red when true.  If both conditions are true, you will see both formats applied (bold text and red cell background color). When the formatting is conflicting (for example red font and green font), the first rule wins.  This can be turned on or off for any rule using the checkboxes on the Conditional Formatting Rules Legend dialog.
  • References to other worksheets.  In Excel 2003, you could not reference ranges on other worksheets in a condition. Excel 12 allows cell references anywhere in the workbook.
  • Support for Number formatting in conditional formatting.  In Excel 12, the Number tab in the Format Cells dialog will be available in conditional formatting so you can set conditional formatting to be number formatting.

With that, we have largely summarized our investment in conditional formatting for Excel 12.  Next time, I will briefly cover how this works in the object model, and then on to formulas and functions.

Posted: Thursday, October 13, 2005 12:04 AM by David Gainer

Comments

Harlan Grove said:

Does the new Data > Sort functionality use a dialog similar to the "Conditional Formatting Rules Legend" one so the order of sort keys can be added, deleted, edited and swapped as easily?
# October 13, 2005 2:04 PM

Harlan Grove said:

David Gainer...
...
|References to other worksheets. In Excel
|2003, you could not reference ranges on other
|worksheets in a condition. Excel 12 allows
|cell references anywhere in the workbook.
...

Not quite accurate. If the cells in other worksheets were named, XL11 (and back to XL97) accepted references using the defined names, and thereby could refer to other worksheets. So it appears this was overly restrictive syntax checking in older versions rather than a lack of functionality.

should we be praising bug fixes and correction of previous design mistakes?

Will Data Validation lists also now accept literal references to other worksheets? Or will those still require the subterfuge of using defined names to provide access to available functionality?

Going further, will advanced data filters be able to handle input, criteria and output (when not filtered in place) ranges in different worksheets?
# October 13, 2005 2:17 PM

mschaef said:

Looks _wonderful_, particularly the "Multiple conditions evaluating to true" bit. Between that and the >3 rules extension, conditional formatting just got a lot more powerful.

This looks nice too: "Support for Number formatting in conditional formatting".

My one concern is that this duplicates (and greatly extends) the conditional formatting capability already present in user defined number formats. This is a big improvement, but it seems like it could end up being pretty confusing.

-Mike (waiting with baited breath for "formulas and functions")
# October 13, 2005 2:40 PM

Jason B said:

I'd love to hear yea or nay on conditional cell protection!
# October 13, 2005 6:50 PM

Jean Martineau said:

Will this "Multiple conditions formatting" be applicable to data field of a Pivot Table based on other field ? For example, suppose you have:

DEMANDID DEMAND_PRIORITY PRODUCT QTY
D1 4 A 10
D2 1 A 10
D3 4 B 10

And you make this pivot table:

Sum of QTY
PRODUCT Total
A 20
B 10
Total 30

You want the data field to have a different color font based on the DEMAND_PRIORITY. For example you want 20 to be in red font since it's correspond to at least one DEMANDID of DEMAND_PRIORITY 1. Right now, I am using Page Field with VBA to select each possible condition to do the formatting in the right sequence. I have also other page fields that I use to format, each page field have it's one area of formatting (one page field use background color, another page field use single and double underline, and so on). The multiple condition formatting is going to be very useful in this case.

I hope this example could help having conditional formatting in pivot tables so they become more and more meaningful.
# October 13, 2005 8:51 PM

Biff said:

[i]If the cells in other worksheets were named, XL11 (and back to XL97) accepted references using the defined names, and thereby could refer to other worksheets.[/i]

Or, using INDIRECT.
# October 13, 2005 11:45 PM

Colin Banfield said:

<<References to other worksheets. In Excel 2003, you could not reference ranges on other worksheets in a condition. Excel 12 allows cell references anywhere in the workbook. <<

This is the same arbitrary limitation (one of them anyway) that I'd like to see removed for result cells when creating a Scenario Summary report, as stated in a previous post.

Colin
# October 14, 2005 2:18 AM

anon said:


"should we be praising bug fixes and correction of previous design mistakes? "

Exactly my thoughts. Excel 12 and its xml serialization fix the idiotic limits in the binary file formats, that's all there is. Not that binary file formats are inherently bad, but the BIFF file format has come of age.

# October 14, 2005 6:57 AM

Tianwei said:

"should we be praising bug fixes and correction of previous design mistakes? "

Yes! Microsoft doesn't owe user anything. They are selling a product. If you dont like it move on to the next brand. On the other hand, we, business and society in general has benefited tremendously in the last decade due to the efficiency brought by Microsoft and other technology companies. Like anything in the world there will be limitations and mistakes.

The world has been running too long in the entitlement culture that we all started to forget the basic virture of thanksgiving.
# October 14, 2005 9:35 AM

Stephen Bullen said:

"References to other worksheets. In Excel 2003, you could not reference ranges on other worksheets in a condition. Excel 12 allows cell references anywhere in the workbook."

Does that include VBA UDFs, functions in XLLs, Automation Addins and XLM functions (or names containing them)?
# October 14, 2005 10:40 AM

Harlan Grove said:

Tianwei...
||"should we be praising bug fixes and
||correction of previous design mistakes? "
|
|Yes! Microsoft doesn't owe user anything.
...

Perhaps it doesn't owe users anything, but it needs to give them something worth spending money to buy. That's the main reason I still use Excel 2000 at home, and why many of my co-workers are still using Excel 97 at work (PCs acquired after 1-Jan-2004 have Excel 2002).

I am pleased at how Excel 2006 seems to be shaping up. It may finally be worth the price of upgrading. My enthusiasm, however, is muted due to having waited for the better part of a decade for many of the features hightlighted in this blog.

We may have a difference of opinion on the extent to which OpenOffice/StarOffice is the driver of so much potentially useful new or improved functionality.
# October 14, 2005 1:18 PM

David Gainer said:

Hello

Harlan – Yes, the new sort dialog shares some design with the Conditional Formatting Rules Legend”. Also, thanks Harlan and Biff for the clarification around cross-worksheet referencing. Data Validation and advanced data filters will behave as in Excel 2003.

Jason – Cell protection is not something we enabled in conditional formatting.

Jean – This is not a scenario we addressed directly. We made three improvements to PivotTables with respect to conditional formatting. First, all the new conditional formatting capabilities can be used on PivotTables. Second, we made it easy to set the “scope” for a rule (for example, apply this conditional format for all instances of a field on a PivotTable). Third, we made it so that conditions track changes in the Pivot sensibly (sort, filter, more data, less data, pivoting). I will go over this in more detail when I post about PivotTables.

Stephen – Yes, if you have a cell on a sheet that contains a VBA UDF, and you reference that cell from a conditional format on another sheet, it will work.
# October 14, 2005 5:53 PM

Stephen Bullen said:

David - I think you misunderstood. I'd like to use a VBA UDF, XLL function and/or Automation Addin function directly in the Conditional Formatting condition - i.e. in the new equivalent of the "Formula is" condition.
# October 16, 2005 3:21 PM

David Gainer said:

Hi Stephen - yes, the plan is that all of those plus XLM should work.
# October 17, 2005 10:15 PM
New Comments to this post are disabled
Page view tracker