简体   繁体   English

根据数值突出显示X个单元格的数量

[英]Highlight X number of cells based on numeric value

I'm creating a vacation tracker in excel. 我正在用Excel创建一个假期追踪器。 The first sheet pulls the data from SharePoint which has Start Date, End Date and a Date Difference calculation. 第一张工作表从SharePoint中提取具有开始日期,结束日期和日期差计算的数据。

Sheet1
A2=12/16/2015
B2=12/20/2015
C2=5

The second sheet is the visualization of the data. 第二页是数据的可视化。 It starts with cell B1 and goes out for 90 days. 它从单元格B1开始,持续90天。 It is a word representation of the date. 它是日期的单词表示。 Here is the formula I'm using =UPPER(TEXT(B2,"DDD")) 这是我使用的公式=UPPER(TEXT(B2,"DDD"))

Sheet2
B1=WED
C1=THU
D1=FRI
E1=SAT
F1=SUN

The next row always B2 has a formula which is always today's date. 下一行始终是B2 ,其公式始终是今天的日期。 From there I add one date to increment the dates out to 90 days. 从那里我添加一个日期,将日期增加到90天。 B2=Today() and the other cells =B2+1 and so forth B2=Today() ,其他单元格=B2+1 ,依此类推

B2=16
C2=17
D2=18
E2=19
F2=20

What I'm trying to do is have the start date and end date highlighted on Sheet2 . 我想做的是在Sheet2突出显示start dateend date For example the boss is out on vacation from 12/16/2015 until 12/20/2015 . 例如,老板从12/16/201512/20/2015 12/16/2015 12/20/201512/16/201512/20/2015 12/16/2015 12/20/2015休假。 I need the cells B3-F3 on Sheet2 highlighted in Red. 我需要工作表Sheet2上的B3-F3以红色突出显示。 The secretary who is on leave from 12/17/2015 to 12/19/2015 have her cells highlighted in another color from cells C4-E4. 谁是休假从秘书12/17/201512/19/2015有她的细胞,从细胞的另一种颜色突出C4-E4.

This will probably take some VBA I just need a starting point. 这可能需要一些VBA,我只是需要一个起点。 I tried using a VLOOKUP to pull the data, however the using a range from another sheet is not working. 我尝试使用VLOOKUP提取数据,但是使用另一张纸上的范围不起作用。 And to be honest I do not know if this is the correct approach. 老实说,我不知道这是否是正确的方法。

Conditional formatting for B2:ZZ2 at Sheet2 在Sheet2上B2:ZZ2条件格式

=AND(B2>=Sheet1!$A$2,B2<=Sheet1!$B$2)

And select the color you like 然后选择你喜欢的颜色

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

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