亞寵展、全球寵物產業風向標——亞洲寵物展覽會深度解析
538
2025-03-31
技巧2_如何僅在部分單元格中設置圖標
譯者:hxhgxy?? 來源:http://blogs.msdn.com/excel 發表于:2006年7月7日
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在每個單元格里畫一個圖表,代表該單元格相對于所選區域中其它單元格中的值。這里有個來自前面帖子里的截圖。
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 … ……并且,你使用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. ……結果,你將得到這樣的東西。Excel將評估所有的單元格,并且在每個單元格里顯示一個圖標,因此,反映的是該區域中每個單元格相對應于其它單元格的數值。
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的地方。這很簡單,只要在編輯規則對話框里設置就可。
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. 最后,確保打開了“為真則停止”標識。
Once you press OK, you will see that indeed, only the values greater than 80 have an icon. 一旦你按下確定,你將看到確實只有大于80的有圖標。
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
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。