定义行的颜色,检查同一单元格中的两个日期和其他单元格中的文本。 Excel 宏?
我有以下问题......
----------------------------------------------------------
Column1 | Column2 | Column3 | Column4 | Column5
----------------------------------------------------------
Bla bla | 26/09/2011 10:00 | blabla | Complete| blabla
| | | |
bla bla | 26/09/2001 11:00 | blabla | |
----------------------------------------------------------
Bla bla | 26/09/2011 11:00 | blabla | | blabla
| | | |
bla bla | 26/09/2001 11:30 | blabla | |
----------------------------------------------------------
Bla bla | 26/09/2011 12:00 | blabla | Started | blabla
| | | |
bla bla | 26/09/2001 13:00 | blabla | |
----------------------------------------------------------
Bla bla | 26/09/2011 22:00 | blabla | | blabla
| | | |
bla bla | 26/09/2001 23:00 | blabla | |
----------------------------------------------------------
在 **Column2 中,每个单元格都有两个带有时间的日期(何时开始和何时结束),在第 4 列中,我有任务的状态。
设置行颜色的条件基于Column2和Column4。
颜色代码将模拟交通信号灯,绿色表示正常,橙色表示意识到,红色表示不良。
如果 Column2 中的单元格的第一个日期大于当前日期,则颜色行为橙色。
如果 Column2 中的单元格的第一个日期大于当前日期并且 Column4 为“开始”,则颜色行为绿色。
如果 Column2 中的单元格的第二个日期大于当前日期,并且 Column4 中的文本不是“完整”,则颜色行为红色。如果文本为“完整”,则将行颜色设置为绿色。
另一件需要考虑的事情是,第二个日期不是日期,而是诸如 TBC 之类的文本和其他内容......
我知道单元格上是否有一个日期时间,我可以使用条件格式,因为有两个日期同样的单元格,我想我需要Excel宏专家的帮助。
提前致谢。
I have the following problem.....
----------------------------------------------------------
Column1 | Column2 | Column3 | Column4 | Column5
----------------------------------------------------------
Bla bla | 26/09/2011 10:00 | blabla | Complete| blabla
| | | |
bla bla | 26/09/2001 11:00 | blabla | |
----------------------------------------------------------
Bla bla | 26/09/2011 11:00 | blabla | | blabla
| | | |
bla bla | 26/09/2001 11:30 | blabla | |
----------------------------------------------------------
Bla bla | 26/09/2011 12:00 | blabla | Started | blabla
| | | |
bla bla | 26/09/2001 13:00 | blabla | |
----------------------------------------------------------
Bla bla | 26/09/2011 22:00 | blabla | | blabla
| | | |
bla bla | 26/09/2001 23:00 | blabla | |
----------------------------------------------------------
In **Column2 each cell have two dates with times(when should start and when should finish), and in column4 I have the status of the task.
The conditions to set the color of the row is based on Column2 and Column4.
The color code would simulate a traffic light Green for OK, Orange for Aware, and Red for Bad.
If first date of the cell in Column2 is greater than current then color row is Orange.
If first date of the cell in Column2 is greater than current and Column4 is "Started" then color row is green.
If second date of the cell in Column2 is greater than current and text in Column4 is not "Complete" then color row is Red. If text is "Complete" then color row Green.
One more thing to consider is that the second date is not a date, but text like TBC and other things.....
I know if it was one date time on the cell I could use conditional formatting, because there are two dates on the same cell, I think I need the help of a excel macro expert.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用条件格式:
例如,对于单元格 B2,对于
单元格中的第一个日期大于当前的日期,使用这些公式对于
单元格中大于当前的第二个日期
其余的(分层条件,考虑状态)应该很简单
You can use conditionitional formatting:
Eg for cell B2, use these formula
for first date in cell greater than current
for second date in cell greater than current
The rest (layering the conditions, factoring in the status) should be straight forward
好吧,我在阅读您的请求时感到有点困惑,但基本上,如果时间/日期与第二个不同,您希望有条件地格式化单元格。
您需要的是类似于下面的内容
现在,如果您不熟悉或不习惯 VBA,那么这会稍微复杂一些。但基本上您可以更改范围和工作表名称来执行您需要的任何操作。 “Interior.Color”函数适用于 vbGreen、vbRed、vbOrange 等。足以满足您的需求。
希望这可以帮助您开始。如果您需要更多帮助,请告诉我。
Ok I got sort of confused reading your request but basically you want to conditionally format the cell if the time/date is different from first to second.
What you need is something like the following
Now if you're not comfortable or used to VBA this is a little more complex. But basically you can change the range and sheet names to do whatever you need it to. The "Interior.Color" function will work with vbGreen,vbRed,vbOrange and several more. More than enough to suit your needs.
Hopefully that can get you started. Let me know if you need more help.