简体   繁体   English

Excel条件格式日期

[英]Excel Conditional Formatting Dates

I have a column A of text (not dates), and I would like it to be filled in with colour when the cell beside it in column B has the same date as today. 我有一列A文字(不是日期),当B列旁边的单元格具有与今天相同的日期时,我希望用颜色填充它。

I have tried to use these formulae in Conditional Formatting: 我试图在条件格式中使用这些公式:

=IF($B:$B = TODAY()) = IF($ B:$ B = TODAY())

=IF(B:B = TODAY()) = IF(B:B = TODAY())

This was applied to the whole A column, and a fill colour was selected, but nothing happened. 这被应用于整个A列,并且选择了填充色,但是什么也没有发生。

Not sure if the formula is the problem. 不确定公式是否有问题。

Thanks! 谢谢!

While you are typing the formula, you need to use the reference for the field the cursor is currently in. 在键入公式时,您需要将引用用于光标当前所在的字段。

So when you select the whole column A, one of the cells is still the 'current' cell (probably A1). 因此,当您选择整个列A时,其中一个单元格仍然是“当前”单元格(可能是A1)。 Write your formula for A1, using relative addressing, and Excel will apply it respectively to all other selected cells (all of A), like =IF(B1=TODAY()) . 使用相对寻址为A1编写公式,Excel会将其分别应用于所有其他选定的单元格(全部为A),例如=IF(B1=TODAY())

Note that B1 is a relative reference, and is interpreted relative to A1 , so for A2 , B2 will used in the comparison. 请注意, B1相对参考,并且相对于A1解释,因此对于A2 ,将在比较中使用B2 If you would want an absolute reference, you would need to add a $ sign in the absolute part, for example =IF(B$1=TODAY()) would color all cells according to the value in B1 . 如果需要绝对引用,则需要在绝对部分中添加$符号,例如=IF(B$1=TODAY())将根据B1的值为所有单元格着色。

See my attachment. 见我的附件。 You just need =$B1=TODAY() on the first cell and drag it down to cover the whole column and that should do the trick for you. 您只需要在第一个单元格上=$B1=TODAY()并将其向下拖动以覆盖整个列,就可以为您解决问题。

在此处输入图片说明

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

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