开发者

How to convert date to week number

开发者 https://www.devze.com 2023-02-10 07:50 出处:网络
How can I convert 20110114 (YYYYMMDD) to开发者_JAVA百科 week, eg WK02-11, in excel ? Thanks.First convert the number in a date. Supposing your number is in A1 cell

How can I convert 20110114 (YYYYMMDD) to开发者_JAVA百科 week, eg WK02-11, in excel ?

Thanks.


First convert the number in a date. Supposing your number is in A1 cell

=DATE(LEFT(A1;4); MID(A1;5;2); RIGHT(A1;2)

Then use WEEKNUM

=WEEKNUM(DATE(LEFT(A1;4); MID(A1;5;2); RIGHT(A1;2), 2)

(gives 3)

Then, if you want, you could embellish the result:

="WEEK-" & WEEKNUM(DATE(LEFT(A1;2); MID(A1;5;2); RIGHT(A1;2), 2) & "-" & LEFT(A1;4)
0

精彩评论

暂无评论...
验证码 换一张
取 消