ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 11991|回复: 15

技巧2:如何仅在部分单元格中设置图标

[复制链接]

TA的精华主题

TA的得分主题

发表于 2006-7-27 11:13 | 显示全部楼层 |阅读模式
本帖已被收录到知识树中,索引项:图标集

Conditional Formatting Trick 2 – How to get an icon in some cells, but not all cells
条件格式窍门2——如何仅在部分单元格而不是全部单元格中设置图标


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在每个单元格里画一个图表,代表该单元格相对于所选区域中其它单元格中的值。这里有个来自前面帖子里的截图。
 

技巧2:如何仅在部分单元格中设置图标

技巧2:如何仅在部分单元格中设置图标

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用户界面允许你从大量的图标集里面选择图标来应用到你的文档,但是,但是,默认情况下,你应用了条件格式的所有单元格都会有一个图标。例如,假设你有这样数据区域(某东西在四个时间段的衡量标准)……

 

技巧2:如何仅在部分单元格中设置图标

技巧2:如何仅在部分单元格中设置图标

… and you applied the “three symbols” icon set using the ribbon …
……并且,你使用Ribbon应用了“三个符号”图标集……
    

技巧2:如何仅在部分单元格中设置图标

技巧2:如何仅在部分单元格中设置图标


… 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.
……结果,你将得到这样的东西。Excel将评估所有的单元格,并且在每个单元格里显示一个图标,因此,反映的是该区域中每个单元格相对应于其它单元格的数值。

技巧2:如何仅在部分单元格中设置图标

技巧2:如何仅在部分单元格中设置图标


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.
我们要做的第一件事情是设置我们刚才应用的规则(“三个符号”规则),这样,红色“X”就会显示在数值大于80的地方。这很简单,只要在编辑规则对话框里设置就可。

技巧2:如何仅在部分单元格中设置图标

技巧2:如何仅在部分单元格中设置图标


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). 
接着要做的事情是添加第二个规则,设置数值小于80的单元格格式,格式为“自动”(默认主题里是透明单元格里的黑色文本)。
Finally, make sure the “Stop If True” flag is turned on.
最后,确保打开了“为真则停止”标识。

技巧2:如何仅在部分单元格中设置图标

技巧2:如何仅在部分单元格中设置图标


Once you press OK, you will see that indeed, only the values greater than 80 have an icon.
一旦你按下确定,你将看到确实只有大于80的有图标。

技巧2:如何仅在部分单元格中设置图标

技巧2:如何仅在部分单元格中设置图标


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.
那么,这是如何进行的呢?Excel在首先每个单元格评估“单元格数值小于80”规则,并且当该规则为真时,Excel就会停止评估该单元格上的条件(这就是“为真则停止”标识做的事情)并设置格式——白底黑字,因此视觉上,这些单元格上没有任何变化。如果第一个条件不为真(意味着那个单元格有个80+的数字),那么Excel就会评估“三个符号”规则,并且在单元格中放置一个红色的“X”。因为其它两个符号(黄色“!”和绿色“√”)和第一个规则(<80)是同样的情况,所以它们永远不会为真,永远不会出现。希望这能够理解。

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 授权转载。严禁任何人以任何形式转载,违者必究。



[此贴子已经被Kevin于2006-7-31 14:44:26编辑过]

TA的精华主题

TA的得分主题

发表于 2007-4-2 08:27 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
慢慢领会

TA的精华主题

TA的得分主题

发表于 2007-4-10 13:55 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册

不错的贴子,支持一下,想问下,怎么都是英文的,是不是这些表格原来都是老外做出来的???

TA的精华主题

TA的得分主题

发表于 2007-4-21 10:30 | 显示全部楼层
很好,这个方法可以用到一些特殊数据的显示上。楼主辛苦了!

TA的精华主题

TA的得分主题

发表于 2007-5-21 23:51 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册

好东西。只可惜公司里只让用Excel2003[em06],盼啊盼,啥时候才能公司才能上2007啊。

感觉一些东西只有在2007里才能得到完美的诠释。。。

TA的精华主题

TA的得分主题

发表于 2007-5-24 09:18 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2007-6-7 10:23 | 显示全部楼层

07版的画面真的很精彩,功能强大.

TA的精华主题

TA的得分主题

发表于 2007-8-2 15:22 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册

嗯,值得研究,谢谢楼主!

我还想问的是,在“色阶”的使用中,能否以某列的数据为标准设置颜色,同时在设置颜色时把整行的颜色都与其在那个列的单元格的颜色保持一致,而不只是那一列有颜色,是整个表都有颜色??(汗,自己都嫌啰嗦了,。。。。)

TA的精华主题

TA的得分主题

发表于 2007-8-7 21:28 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2007-8-23 17:38 | 显示全部楼层
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-4-16 16:56 , Processed in 0.049233 second(s), 15 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表