简体   繁体   English

仅格式化值等于或大于X的最后一个单元格

[英]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.

相关问题 如果值高于另一个单元格,则复制单元格 - Copy cells if value is higher than another cell Excel VBA-基于单元格值的格式(大于,小于,等于) - Excel VBA - Format based on cell value (Greater than, less than, equal to) 如果 TextBox 值高于 VBA 中的特定单元格,则显示错误消息 - Show an error message if a TextBox value is higher than a specific cell in VBA Excel公式,如果IF单元格编号“小于” X,“位于X和Y之间”或“大于” Y,则等于A,B,C - Excel formula for IF cell number is 'lower' than X, 'in between' X and Y or 'higher' Y then equals A, B, C Excel格式/突出显示基于最后日期和相等单元格值的行 - Excel formatting/Highlight row based on the last date and equal cell value 如何从最后一个单元格中查找秒不等于0,并返回标头值 - How to LOOKUP second from last cell not equal to 0, and return header value 如果单元格值的最后 2 位大于和小于 - If Last 2 Digits Of Cell Value Are Greater Than And Less Than 当单元格值不等于“X”时,是否有一个 vba 代码会打开一个 msgbox? - Is there a vba code which opens a msgbox when cell value is not equal to “X”? Excel-当单元格等于x时查找范围值 - Excel - Find value of range when cell is equal to x VBA - 如果单元格包含某个值而不是等于或不等于,则复制值 - VBA - Copy value if cell CONTAINS certain value rather than equal to or not equal to
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM