[英]Week number based on Date
I need to make week number based on given date. 我需要根据给定的日期制作星期数。
Today 28-08-18 今天28-08-18
Week ..... 周...
30-07-18 1
06-08-18 2
13-08-18 3
20-08-18 4
27-08-18 5
03-09-18 6
10-09-18 7
17-09-18 8
24-09-18 9
01-10-18 10
08-10-18 11
15-10-18 12
22-10-18 13
29-10-18 14
I want the cell next to "week" to be based on today's date. 我希望“周”旁边的单元格基于今天的日期。
The formula is as follows: Floor((First date - Current date)/7). 公式如下:下限((第一个日期-当前日期)/ 7)。
Useful link for subtraction: http://www.theexceladdict.com/_t/t040303.htm . 减法的有用链接: http : //www.theexceladdict.com/_t/t040303.htm 。
Good luck, Alex 祝你好运,Alex
Assuming 30-07-18 is located @ A1. 假设30-07-18位于A1。 in B1, type in :
在B1中,输入:
=WEEKNUM(A1,2)-WEEKNUM($A$1,2)+1
and drag it down. 并将其向下拖动。 Glad that you'd tried.
很高兴您尝试过。 ( :
(:
All the best. 祝一切顺利。
Your base date (BD) may not be the start of the week (SOW), so the general solution could be 您的基准日期(BD)可能不是一周的开始(SOW),因此一般的解决方案可能是
SOW
from your base date: SOW = BD - WEEKDAY(BD)+2
SOW
: SOW = BD - WEEKDAY(BD)+2
DI
from given date (GD) to SOW
: DI = GD - SOW
SOW
的距离DI
: DI = GD - SOW
EDIT: 编辑:
SOW = IF(WEEKDAY(BD)=1;BD-6;BD-WEEKDAY(BD)+2)
this is to cover cases where BD is a Sunday and SOW should be the Monday before (not after) 这是为了涵盖BD是星期天而SOW应该是星期一之前(而不是之后)的情况
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.