+ Reply to Thread
Results 1 to 5 of 5

Convert YYYYWW to date

  1. #1
    Registered User
    Join Date
    09-15-2006
    Posts
    31

    Convert YYYYWW to date

    Hi!

    Is it possible to convert for example 200801 to a specific date?

    Examples:
    200801 to become 31/12/2007
    200802 to become 07/01/2008
    200805 to become 28/01/2008
    200810 to become 03/03/2008

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    assuming your values are in A1:A4 would the following work for you:

    B1: =DATE(LEFT(A1,4),1,1)+((RIGHT(A1,2)-1)*7)+(1-(WEEKDAY(DATE(LEFT(A1,4),1,1),2)))

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    i think you can shorten that to
    =DATE(LEFT(A1,4),1,1)+RIGHT(A1,2)*7-8

  4. #4
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    This seems to work and is shorter than the Donkey's

    =DATE(LEFT(A1,4)+0,1,(RIGHT(A1,2)-1)*7)

    or this:

    ="31/12/2007"+(RIGHT(A1,2)-1)*7
    Richard Schollar
    Microsoft MVP - Excel

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    Yes assuming of course you're only looking at 2008 the one I posted should work with any year week combination assuming OP first date to be returned should be the Monday of the week in which 1st of year appears.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1