2014-03-26  作者:ExcelHome  阅读:
译者:hxhgxy   来源http://blogs.msdn.com/excel
Conditional Formatting Trick 2 – How to get an icon in some cells, but not all cells
A few months ago, I described the new features we have added to Excel 2007 in the area of conditional formatting.  One of the new formats we added is called a “icon set” … check out this earlier post for a refresher, but the basic idea is that Excel draws an icon in each cell representing the value of that cell relative to the other cells in the selected range.  Here is a shot from that post.
几个月前,我描述了我们在Excel 2007的条件格式方面添加的新功能。我们添加的新格式之一叫做“图标集”……请重温一下前面的帖子,基本原理是Excel在每个单元格里画一个图表,代表该单元格相对于所选区域中其它单元格中的值。这里有个来自前面帖子里的截图。
The Excel 2007 UI allows you to choose from a wide range of icon sets to apply to your document, but, but, by default, all the cells that you apply conditional formatting to get an icon.  For example, say you had this range of data (measurements of something over 4 time periods) …
Excel 2007用户界面允许你从大量的图标集里面选择图标来应用到你的文档,但是,但是,默认情况下,你应用了条件格式的所有单元格都会有一个图标。例如,假设你有这样数据区域(某东西在四个时间段的衡量标准)……
… and you applied the “three symbols” icon set using the ribbon …
… you would end up with something like this.  Excel would evaluate all the cells and show an icon in each cell, thereby communicating the value of each cell relative to all cells in the range.
点击看大图 Fair enough, and useful.  One of the bits of beta feedback we have received, though, is it sure would be nice to be able to only show a single icon in a cell if the cell met some criteria – for example, you might just want to see a red “X” in any cells that have a value greater than 80 (because 80 is bad).  While we did not have time to add a single rule to enable that in Excel 2007 (it is on the list for future consideration), it is possible, so I wanted to show folks how.
还算有用。但是,我们收到的beta版的反馈之一是,如果能只在某些符合某个标准的单元格里显示图标的话,那将更好——例如,你也许只想在任何大于80(因为80是不好的)的单元格里看到一个红色的“X”。虽然我们没有时间在Excel 2007里添加规则来激活该功能(它在将来要考虑的清单之中),但是,这是可能的,因此,我想给大家演示如何实现。
The first thing we need to do is to set the rule we just applied (the “three symbols” rule) so that the red “X” shows up for values greater than 80.  That’s as simple as tweaking a setting in the Edit Rules dialog.
点击看大图 The next thing to do is to add a second rule that formats values that are less than 80, and set the format to “Automatic” (black text on transparent cells for the default theme). 
Finally, make sure the “Stop If True” flag is turned on.
Once you press OK, you will see that indeed, only the values greater than 80 have an icon.
  So how does this work?  Excel evaluates the “Cell Value <80” rule on each cell first, and if the rule is true, Excel stops evaluating the conditions on that cell (that’s what the “Stop If True” flag does) and applies the format, which is set to black on white, so visually nothing changes in those cells.  If the first rule is not true (meaning the cell has a number 80+), Excel evaluates the “three symbols” rule, and puts a red “X” in the cell.  Because the other two symbols (yellow ! and green check mark) have the same condition as the first rule (<80), they are never true and hence they are never seen.  Hopefully that makes sense.
The “Stop If True” setting turns out to be pretty handy, and I expect that users will find all sorts of creative uses beyond just this case.
Published Tuesday, May 09, 2006 9:52 PM by David Gainer
Filed Under: Conditional Formatting
注:本文翻译自http://blogs.msdn.com/excel ,原文作者为David Gainer(a Microsoft employee),Excel Home 授权转载。严禁任何人以任何形式转载,违者必究。
Copyright 1999 - 2017 Excel Home.All Rights Reserved.
本站特聘法律顾问:徐怀玉律师 李志群律师   沪ICP备11019229号 沪公网安备 31011702000001号