简体   繁体   English

Excel中的公式:匹配年份和日期

[英]Formula in Excel: Matching Year and Date

I have a date column and year column in this date column year must match with year column .. 我在此日期列中有日期列和年份列,年份必须与年份列匹配。

like if date column have year 2019 then year column must be 2019 if 2017 then must be 2017 .. 例如,如果日期列的年份为2019,则年份列的值必须为2019,如果2017年则必须为2017 ..

  Date         Year 
    01-02-2019   2019
    02-09-2018     2018
   03-10-2017       2019
  04-11-2017        2018

so here i want to identify those who are not match date(year) and year column and highlight with yellow color . 所以在这里我想确定那些不匹配date(year)和year列的人,并用黄色突出显示。 like last 2 records are incorrect so want to highlight with yellow color 像最后2条记录不正确,所以要用黄色突出显示

Through conditional formatting: 通过条件格式:

  • Select A2:B5 选择A2:B5
  • New conditional formatting rule through formula: 通过公式的新条件格式设置规则:

     =YEAR($A2)<>$B2 
  • Choose format and apply 选择格式并套用

在此处输入图片说明


To highlight the entire row: 要突出显示整个行:

  • Select rows 2:5 选择第2:52:5
  • Follow the same steps as above 遵循与上述相同的步骤

在此处输入图片说明

在C列= B1 = Year(A1)中,然后使用条件格式进行格式化。

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

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