简体   繁体   English

Excel中的复杂条件格式

[英]Complex Conditional Formatting in Excel

I have a column of numbers. 我有一列数字。 I want to be able to highlight a cell in another column if, there are three numbers in three consecutive cells in the column greater than zero and the three numbers add up to less than 71. If there are only one or two numbers in three consecutive cells greater than zero nothing should happen. 我希望能够突出显示另一列中的一个单元格,如果该列中的三个连续单元格中有三个数字大于零并且三个数字加起来小于71。如果连续三个中只有一个或两个数字大于零的单元格将不会发生。 I know how to set up the conditional formatting to highlight the cell in another column, what I don't know how to do is construct a formula that will look at the numbers in the column and pick out 3 consecutive non-zeros that add up to less than 71 (or if that can be done at all). 我知道如何设置条件格式以突出显示另一列中的单元格,我不知道该怎么做,构造一个公式,该公式将查看列中的数字并挑选出3个连续的非零加起来小于71(或完全可以做到)。

Excel工作表范例

The conditional formatting formula would be 条件格式公式为

=AND(COUNTIF(B1:B3,">0")=3,SUM(B1:B3)<71)

applied to cells A1:A28 in the data above. 应用于以上数据中的单元格A1:A28。 The only cell which fits the criteria and should be highlighted is cell A9. 符合条件且应突出显示的唯一单元格是A9单元格。

Because of relative addressing the formula always looks in the three cells in column B starting with the current row, eg for row 9 the formula is effectively 由于相对寻址,因此该公式始终从当前行开始在B列的三个单元格中查找,例如,对于第9行,该公式有效

=AND(COUNTIF(B9:B11,">0")=3,SUM(B9:B11)<71)

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

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