当前位置:首页 > 办公设计 > Office教程 > 技巧1_色彩缤纷的Data Bars

技巧1_色彩缤纷的Data Bars

11个月前 (05-24)Office教程970

译者:Kevin  来源:http://blogs.msdn.com/excel
发表于:2006年7月7日

Conditional Formatting Trick 1 – Multi-Coloured Data Bars
条件格式技巧1——色彩缤纷的Data Bars

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 “data bar” … check out this earlier post for a refresher, but the basic idea is that Excel draws a bar 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中新增加的有关条件格式的各种特性,其中之一就是我们称之为“data bar”的……可参阅以前的文章。但是我们只讲到最基础的概念,即在一个选定的区域里面,由Excel根据不同单元格的数值对比情况,在每个单元格中绘制一个色带。下面是以前文章中的截图:

The Excel 2007 UI allows you to choose whatever colour you want for your data bars, but, by default, all the data bars you apply to a range have to be the same colour. Someone on our team recently showed me how to use a tiny bit of VBA to simulate having multiple colours of data bars on a range conditionally applied, so I thought I would pass along the trick.
Excel 2007允许你为你的data bars选择任何你想要的颜色,但是,默认情况下,同一区域中的data bars,只能有同一种颜色。最近,开发团队中的某位成员向我展示了如何在同一区域中创建多种颜色的data bars,只需要利用非常简单的VBA代码即可。所以,我想我应该好好发挥这个技巧的威力。

Say, for example, you are looking at student grades, and you want all the data bars for students with a passing mark (60%+ and above) to be green, and those with a failing grade (59% or less) to be red. The first thing you would do is to add some red data bars to your data, and then some green data bars. By default, Excel shows you the last set applied, so the data bars would be green. If you then launch the VB Editor (Alt + F11) and in the immediate window (Ctrl+G), type:
selection.FormatConditions(1).formula = “=if(c3>59, true, false)”
You would see that your data now looks like this, which makes it easy to spot the failing grades.

举个例子,你正在考虑为学生评分,你希望当学生成绩及格(60%或更高)时,data bars是绿色的,而不合格的成绩(59%或更低)对应的data bars是红色的。第一步,你肯定会为你的数据加上一些红色的data bars,然后是绿色的。在默认情况下,Excel只接受你最后的设置,所以所有的data bars都将是绿色的。如果你现在打开VB编辑器(Alt + F11),在立即窗口(Ctrl+G)中输入:selection.FormatConditions(1).formula = “=if(c3>59, true, false)”
你将会看到你的数据就会像下面这样,非常容易的辨识出不合格的成绩:

So how does this work? Every conditional format has a Formula property, which allows you to specify a formula which determines whether the conditional format is visible. In this case, we are simply saying that the green data bars (the most recent ones) should only be visible if a value is greater than 59.
This property is available on all conditional formats, so I expect that users will find all sorts of creative uses beyond just this case.

那么这项工作是如何完成的?原来,每一个条件格式都有一个公式的属性,此属性允许你指定一个公式来判断其本身是否可见。在这个例子中,我们简单的指定为,只有单元格数值大于59时,绿色的data bars才会被显示。
所有的条件格式都可以利用这个属性,因此,我希望用户能够发挥创造力,举一反三。

Published Friday, February 24, 2006 1:32 PM by David Gainer

注:本文翻译自http://blogs.msdn.com/excel ,原文作者为David Gainer(a Microsoft employee),Excel Home 授权转载。严禁任何人以任何形式转载,违者必究。

扫描二维码推送至手机访问。

欢迎转载或分享本篇文章。

本文链接:https://www.jcba123.com/article/1137

分享给朋友:

“技巧1_色彩缤纷的Data Bars” 的相关文章

Excel超级表如何使用?来看看超级表到底有多牛吧!

Excel超级表如何使用?来看看超级表到底有多牛吧!

Excel中有一项功能,可将普通表格转换成“超级表”,为什么要转换成超级表?还有,转成超级表有什么作用?今天,小汪老师就来给大家展示一下超级表是如何的强大!   普通表格转超级表 如何将Excel中普通的表格变成超级表?非常简单,我们只需将光标定位到该表格中,然后使用...

Excel制作可自动更新的下拉菜单,80%的人都不知道!

Excel制作可自动更新的下拉菜单,80%的人都不知道!

Excel下拉菜单可以帮助我们提升工作效率,实现快速录入功能。但许多人只知其一不知其二,下拉菜单也分很多种做法,哪一种最佳?今天,易老师就来给大家分享一下可自动更新的下拉菜单的制作。     大多数人是这样做下拉菜单的 选择需要添加下拉菜单的所有单元格,进入...

Excel旋风图图表制作技巧,数据比较分析更方便

Excel旋风图图表制作技巧,数据比较分析更方便

今天教大家使用Excel来制作一份旋风图图表,该图表主要特点就是便于两种不同数据的分析对比,能够让我们更有效的查看对比效果。     Excel旋风图效果     Excel旋风图制作 1、首先,我们插入图表。选中数据,点击「插入」...

不用PS,PPT也能制作撕裂文字效果

不用PS,PPT也能制作撕裂文字效果

在以前撕裂文字只有在PS之类的图片处理软件中才能够实现,但是随着PPT的更新升级,出现了许多好用的功能,很多只能在PS中实现的效果,我们PPT一样能够完成。 输入文字 步骤一:首先,我们得输入文字,在做撕裂文字效果的时候,我建议大家一个字一个字的做,不要一回输入多个字。点击【插入】选项卡,...

让你秒懂Word自动生成目录的操作方法

让你秒懂Word自动生成目录的操作方法

Word排版中自动生成目录一项是许多人的痛楚,特别是在制作长篇文档排版的时候,我们经常会生成目录,那么生成目录要满足哪些条件呢?又应该如何生成呢?今天,易老师就详细的为大家介绍讲解一下! 自动生成目录前提条件 首先,你要明白,不是什么样的长篇文档都适合生成目录的。我们需要满足一些基本条件,...

动态任务时钟制作PPT教程(一)

动态任务时钟制作PPT教程(一)

每日一练 动态时钟制作:继续我喜欢的PPT2013节奏! 背景制作:制作方法(1.选择插入——形状——矩形 2.设置渐变填充(参数设置见图)) 原图欣赏: 底面制作:制作方法(1.选择插入——形状——圆角矩形;2.调节黄色手柄,使其弧度与原图相近;3.去除...

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。