如何根据复杂的公式填充单元格? [英] How to fill cells based on complicated formula?

查看:147
本文介绍了如何根据复杂的公式填充单元格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个复杂的公式。我想要做的是将A列设置为YR,如果日期超过2年前列BJ将突出显示红色,如果日期在达到2年标记的30天内,则为黄色。 / p>

如果列A为P1,P2,P3,P4或P5,则如果日期超过1年前列BJ将突出显示红色,如果在30天内显示黄色达到一年的标志。

解决方案

您将需要创建两个条件格式规则。首先选择B2:J6(如下图所示,底行将随您自己的数据而变化),B2作为活动单元格。使用使用公式确定要格式化的单元格创建新公式,并为格式输入以下公式:

  = AND(OR($ A2 =P1,$ A2 =P2,$ A2 =P3,$ A2 =P4 A2 =P5,$ A2 =YR),B2< = EDATE(TODAY(),(1 +($ A2 =YR))*  -  12))

点击格式并提供一个红色填充。我还添加了一个白色字体,以便于阅读。单击确定接受格式,然后再次单击确定创建新规则。



对于B2:J6仍然选中,请重复以下公式进行黄色填充。 p $

  = AND(OR($ A2 =P1,$ A2 =P2,$ A2 =P3,$ A2 = P4,$ A2 = P5,$ A2 = YR),B2> EDATE(TODAY(),(1 +($ A2 = YR))*  -  12),B2< =(EDATE (TODAY(),(1 +($ A2 =YR))*  -  12)+30))

你的结果应该类似于以下内容。




I have a complicated formula. What I'm looking to do is to set it up where if column A is YR then column B-J will highlight red if the date is more than 2 years ago and yellow if the date is within 30 days of reaching the 2 year mark.

If column A is P1, P2, P3, P4, or P5 then column B-J will highlight red if the date is more than 1 year ago and yellow if its within 30 days of reaching the one year mark.

解决方案

You will want to create two conditional formatting rules. First select B2:J6 (as laid out in the image below, the bottom row will vary with your own data) with B2 as the Active Cell. Create a new formula using the Use a formula to determine which cells to format and supply the following for Format values where this formula is true:

=AND(OR($A2="P1",$A2="P2",$A2="P3",$A2="P4",$A2="P5",$A2="YR"),B2<=EDATE(TODAY(),(1+($A2="YR"))*-12))

Click Format and supply a red Fill. I also added a white Font for readability. Click OK to accept the format and then OK again to create the new rule.

With B2:J6 still selected, repeat with the following formula for a yellow fill.

=AND(OR($A2="P1",$A2="P2",$A2="P3",$A2="P4",$A2="P5",$A2="YR"),B2>EDATE(TODAY(),(1+($A2="YR"))*-12),B2<=(EDATE(TODAY(),(1+($A2="YR"))*-12)+30))

You results should be similar to the following.

     

这篇关于如何根据复杂的公式填充单元格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆