简体   繁体   English

基于Excel 2013中上一个单元格的条件格式

[英]Conditional formatting based on the previous cell in Excel 2013

I am trying to indicate improvements in the scores with the icon set of arrows. 我试图用箭头图标来表示分数的提高。 Since I have multiple columns each cell should be indicating incline or decline based only on previous cell. 由于我有多列,因此每个单元格应该仅基于前一个单元格来指示倾斜或下降。

If I use a normal formatting provided by excel in the number order: 20,30, 40 如果我按数字顺序使用excel提供的常规格式:20,30,40

Excel indicates that decline has been made with number 30 (arrow pointing downwards) however it should be indicated as increase. Excel表示数字30有所下降(箭头指向下方),但应表示为上升。 Can someone please help me? 有人可以帮帮我吗?

thank you for your time, review and answer. 谢谢您的宝贵时间,复习并回答。

If you want a formula that can be copied (as text and a cell, not just copying a cell), which makes it more versatile, you can use this: 如果您想要一个可以复制的公式(作为文本和单元格,而不仅仅是复制单元格),从而使它更加通用,则可以使用以下方法:

=INDIRECT(ADDRESS(ROW()-1, COLUMN()))>INDIRECT(ADDRESS(ROW()-1, COLUMN()-1))

This is to apply the formatting for a rise; 这是为了套用格式。 change the comparison operator for equal and decrease formatting. 更改比较运算符以等于并减少格式。

Here's how it works: 运作方式如下:

  • =ADDRESS(ROW(), COLUMN()) refers to the current cell (ie the one to be formatted). =ADDRESS(ROW(), COLUMN())引用当前单元格(即要格式化的单元格)。
  • Similarly, =ADDRESS(ROW()-1, COLUMN()) refers to the cell above the current cell while =ADDRESS(ROW()-1, COLUMN()-1) refers to the cell above and to the left of the current cell. 同样, =ADDRESS(ROW()-1, COLUMN())指向当前单元格上方的单元格,而=ADDRESS(ROW()-1, COLUMN()-1)指向当前单元格上方和左侧的单元格当前单元格。 These are the two cells you want to compare. 这是您要比较的两个单元格。 Then all I do is compare the two. 然后,我要做的就是比较两者。

There is a way to apply a conditional format based on other cells contents. 有一种方法可以基于其他单元格内容来应用条件格式。 This does not give you icons (as arrows), but colors the cells, for instance. 这不会给您图标(如箭头),但是会给单元格上色。 It might be good enough for you. 对您来说可能已经足够了。

Conditional Formatting -> New Rule -> Use a formula to determine which cells to format 条件格式 -> 新规则 -> 使用公式来确定要格式化的单元格

The figure shows an example of what you may obtain (the icons row is described below). 该图显示了您可以获取的示例(下面描述了图标行)。

It is essential that you use relative referencing in the formula . 在公式中使用相对引用至关重要 Check this answer . 检查此答案

在此处输入图片说明

There are other options which involve creating additional helper cells, eg, row 4 in the figure. 还有其他选项涉及创建其他辅助单元,例如图中的第4行。 The amount of extra effort, and whether it is ok for you, depends on the size and structure of your worksheet. 额外的工作量以及是否适合您,取决于工作表的大小和结构。

For the row of icons, I used something similar to 2 and 3 below. 对于图标行,我使用了与下面的2和3类似的东西。 Enter in C4 the formula =IF(C3>B3,3,IF(C3=B3,2,1)) and copy to the right. 在C4中输入公式=IF(C3>B3,3,IF(C3=B3,2,1))并复制到右侧。 Then apply the Conditional Formatting -> Icon Sets , and select Show Icon Only . 然后应用“ 条件格式设置” ->“ 图标集” ,然后选择“仅显示图标”

Check 校验

  1. https://superuser.com/questions/591120/excel-conditional-formatting-using-icon-sets https://superuser.com/questions/591120/excel-conditional-formatting-using-icon-sets
  2. Conditional formatting: Showing direction arrows for a series 条件格式:显示一系列的方向箭头
  3. https://www.ablebits.com/office-addins-blog/2014/06/05/excel-conditional-formatting-icon-sets-data-bars-color-scales/ , go to Example 2. Add icons based on another cell's value . https://www.ablebits.com/office-addins-blog/2014/06/05/excel-conditional-formatting-icon-sets-data-bars-color-scales/ ,转到示例2。根据添加图标另一个单元格的值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM