简体   繁体   中英

Convert date to Wyy(week number) Format

I am working with Excel 2010. I wish to convert (for example) cell A1 with today's date in the format 4/10/2017 to a format which is W1715 (W(last two digits of year)(weeknumber)). It would be great if anyone could help! Thanks in Advance.

If A1 has the Date and is formatted as Date (Excel recognize it as Date) just write in B1 where you want the result:
="W"&VALUE(RIGHT(YEAR(A1),2))&WEEKNUM(A1,1)
Right(Year(A1),2) returns the last 2 digits of the four digit of the Year
Weeknum returns the number of the week 1 correspond at 1st week is the week which has the 1st of January week begins on Sunday

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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