简体   繁体   English

基于Excel中每行中不确定行数确定的值的条件格式

[英]Conditional formatting based on a value determined in each row in Excel for indeterminate amount of rows

So I've got a cell that I'd like to colour orange if the date in that cell (lets say that cell is C1) is later than a date in a cell (lets say B1) somewhere on that same row. 因此,如果该单元格中的日期(假设该单元格为C1)晚于同一行某处的某个单元格(例如说B1)中的日期,则我想将其着色为橙色。 I can conditional format C1 to do this. 我可以有条件地格式化C1来做到这一点。 All good. 都好。 But then I'd like to create an indeterminate amount of rows like this. 但是然后,我想创建数量不确定的行。 The two dates which I want to compare are in the same column in every row, but are compared per row. 我要比较的两个日期在每一行的同一列中,但每行进行比较。 So one date in C1 will compare to B1. 因此,C1中的一个日期将与B1相比较。 Another in C2 will compare to B2. C2中的另一个将与B2比较。 There doesn't seem to be a conditional formatting technique to achieve this. 似乎没有条件格式化技术可以实现此目的。 Help? 救命?

Ps: A few things I've tried is using If statements but I can't seem to work out how to do it. 附:我尝试过的一些事情是使用If语句,但是我似乎无法解决该问题。 I've also tried conditionally formatting one row and then using "insert" to replicate the condition formatting of the row above it but this seems to start comparing the inserted row to the date in the row above... 我也尝试过有条件地格式化一行,然后使用“插入”来复制其上方行的条件格式,但这似乎开始将插入的行与上方行中的日期进行比较...

In order to apply conditional formatting to a range you can select the range first (and then that range will automatically become the "applies to" range in conditional formatting) 为了将条件格式应用于范围,您可以先选择范围(然后该范围将自动成为条件格式中的“应用于”范围)

....then set the formula that applies to the first row of that range only ....然后设置仅适用于该范围第一行的公式

....then select appropriate formatting ....然后选择适当的格式

As long as the formula uses the correct relative references that's sufficient to make it work for the entire range 只要公式使用正确的相对引用就足以使它适用于整个范围

So in your specific case you can select the whole column, or a specific range like C1:C100 and then apply the formula that you need for the first row of that range, ie 因此,在您的特定情况下,您可以选择整列或C1:C100类的特定范围,然后将所需的公式应用于该范围的第一行 ,即

=C1>B1

Another way to achieve this is to apply the formula to the first row only (as you have done already) then click on "format painter" (the little brush on the Home ribbon)......then select the range to copy to (eg C2:C100) 实现此目的的另一种方法是仅将公式应用于第一行(如您已经完成的操作),然后单击“格式刷”(“首页”功能区上的小笔刷)……然后选择要复制的范围到(例如C2:C100)

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

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