[英]Format the last cell only with value equal or higher than X
How do I use conditional formatting to format only the last cell in each column with a minimum value ? 如何使用条件格式仅格式化每列中最后一个具有最小值的单元格?
This implies a non-VBA solution. 这意味着非VBA解决方案。
I have tried using this formula, but it stops after first match (5 is formatted): 我尝试使用此公式,但在第一个匹配项(格式为5)后停止:
AND(A2>=5,COUNTIF($A$2:A2,">=5")=1)
Using this data, only 9 should be formatted. 使用此数据,仅应格式化9个。
Data : 资料 :
1
2
3
4
5 <-- actual result
6
7
8
9 <-- expected result
UPDATE: 更新:
This formula seems to do the trick, but only works when the cell values in the range are numeric, which mine are, and only in 1 column. 该公式似乎可以解决问题,但是仅当范围中的单元格值为数字(属于我的)且仅在1列中时才有效 。 Range must match format area. 范围必须与格式区域匹配。
Note: I found the "INDEX..E+307" part somewhere else, but lost the URL so cant give credit. 注意:我在其他地方找到了“ INDEX..E + 307”部分,但丢失了URL,因此无法兑现。
AND(A2>=5,A2=INDEX($A$2:A10,MATCH(9.99999999999999E+307,$A$2:A10)))
A multi-column supported formula is now needed. 现在需要一个多列支持的公式。 Using OFFSET
might be the way to go.. 使用OFFSET
可能是一种方法。
I'm reading the problem as this: 我正在阅读的问题是这样的:
We want to highlight the last cell in the column, but only when the cells in that column contain at least one sufficiently large value. 我们要突出显示列中的最后一个单元格,但仅当该列中的单元格包含至少一个足够大的值时才突出显示。
Assuming data starts in A1
, I came up with this: 假设数据从A1
开始,我想到了这一点:
=AND(COUNTIF(OFFSET(A$1,,,COUNT(A:A),1),">=5")>0,ROW()=COUNT(A:A))
There are some assumptions there: like we can say that the number of non-empty values can be counted by COUNTA()
, or that data starts in row 1 so that we can find the last row with ROW()=COUNT(A:A)
. 那里有一些假设:就像我们可以说COUNTA()
可以计算非空值的数量,或者数据从第1行开始,这样我们可以找到ROW()=COUNT(A:A)
的最后一行ROW()=COUNT(A:A)
。 But hopefully you get the idea... 但是希望你能明白...
If you are in fact looking for the greatest value, not the last one, then this be a starting point: 如果您实际上是在寻找最大的价值,而不是最后一个,那么这是一个起点:
AND(A2>=5,A2=MAX($A$2:A10))
That should work to locate the highest value across multiple columns as well. 这样也可以在多个列中定位最高值。 If your table can grow over time then you should look at defining the range with an OFFSET()
formula. 如果您的表可以随着时间增长,那么您应该考虑使用OFFSET()
公式定义范围。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.