Home » excel » excel – How to get week number from custom date string

excel – How to get week number from custom date string

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have this type of strings

DECW42012
JANW12013
JANW22013
JANW32013
JANW42013
JANW52013
FEBW12013

Can i somehow get week number (not in month but in year) from that string ?
thank you

How to&Answers:

=WEEKNUM(DATE(RIGHT(A1,4),MONTH(LEFT(A1,3)&1),1),2)+(MID(A1,5,1)-1)

Should do the trick.

Answer:

You could start with the following,

=WEEKNUM(DATEVALUE(LEFT(A1,3)&RIGHT(A1,4))+(MID(A1,5,1)-1)*7)

      WEEKNUM function

The WEEKNUM function has an optional return_type parameter that I have not implemented and that is one that you should pay close attention to if you wish to get the correct returns for your week numbe schedule.

Edited: dropped the week-of-month by 1 before multiplication