Excel - 当单元格中的日期落在某个日期范围内时填充单元格

时间:2021-11-19 23:39:07

I have a spreadsheet that has a single column ('I') with dates in it. I would like the cells in this column to change colour depending on the Quarter that the date falls in.

我有一个电子表格,其中包含一个包含日期的列('I')。我希望此列中的单元格根据日期所在的季度更改颜色。

Dates falling in the range;

日期落在范围内;

  • DEC-FEB = RED
  • DEC-FEB = RED
  • MAR-MAY = GREEN
  • MAR-MAY =绿色
  • JUN-AUG = BLUE
  • JUN-AUG =蓝色
  • SEPT-NOV = YELLOW
  • SEPT-NOV =黄色

All dates are formatted as dates (dd/mm/yyyy)

所有日期都格式化为日期(年/月/日)

I've tried a range of IF/AND statements but keep getting hung up on the year, and to be honest, I've forgotten most of what I've tried. Sorry for the lack of info, i tried posting a screenshot but got knocked back.

我已经尝试了一系列的IF / AND语句但是在这一年里一直挂断,说实话,我已经忘记了我尝试过的大部分内容。很抱歉缺少信息,我尝试发布截图但被击退了。

1 个解决方案

#1


1  

Try this:

尝试这个:

=OR(MONTH(I2)=12,MONTH(I2)=1,MONTH(I2)=2)
=OR(MONTH(I2)=3,MONTH(I2)=4,MONTH(I2)=5)
=OR(MONTH(I2)=6,MONTH(I2)=7,MONTH(I2)=8)
=OR(MONTH(I2)=9,MONTH(I2)=10,MONTH(I2)=11)

Note, I'm assuming you have a header row, hence these formula reference I2.

注意,我假设你有一个标题行,因此这些公式引用了I2。

#1


1  

Try this:

尝试这个:

=OR(MONTH(I2)=12,MONTH(I2)=1,MONTH(I2)=2)
=OR(MONTH(I2)=3,MONTH(I2)=4,MONTH(I2)=5)
=OR(MONTH(I2)=6,MONTH(I2)=7,MONTH(I2)=8)
=OR(MONTH(I2)=9,MONTH(I2)=10,MONTH(I2)=11)

Note, I'm assuming you have a header row, hence these formula reference I2.

注意,我假设你有一个标题行,因此这些公式引用了I2。