+ Reply to Thread
Results 1 to 5 of 5

Generate calendar weeks in cells

  1. #1
    Forum Contributor
    Join Date
    02-18-2013
    Location
    Berlin, Germany
    MS-Off Ver
    Excel 2016
    Posts
    221

    Generate calendar weeks in cells

    Hi!

    I want to generate a succesion of calendar weeks in a row. Something like this:

    Please Login or Register  to view this content.
    So: CW "the number of week" ("the date of the monday of the week" - "the date of the friday of the week")

    Can I do this without a macro?

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Generate calendar weeks in cells

    Yes, but the date will have to be based on some "anchor" like the column of the cell. Also you have to indicate what year you want.

    I assumed that CW 1 is in column A, and the year is the current year, and CW 1 starts on the first Monday of the year.

    It is a very long formula. This formula could be simplified with the use of named formulas. Let me know if you would like to develop that.

    ="CW "&COLUMN()&" ("&DAY(DATE(YEAR(TODAY()),1,1)+(7-WEEKDAY(DATE(YEAR(TODAY()),1,1),12))+7*(COLUMN()-1))&"."&MONTH(DATE(YEAR(TODAY()),1,1)+(7-WEEKDAY(DATE(YEAR(TODAY()),1,1),12))+7*(COLUMN()-1))&" - "&DAY(DATE(YEAR(TODAY()),1,1)+(7-WEEKDAY(DATE(YEAR(TODAY()),1,1),12))+7*(COLUMN()-1)+4)&"."&MONTH(DATE(YEAR(TODAY()),1,1)+(7-WEEKDAY(DATE(YEAR(TODAY()),1,1),12))+7*(COLUMN()-1)+4)&")"
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Generate calendar weeks in cells

    I get the results you're looking for with the following:

    ="CW " & COLUMN()+ 15 & " " & TEXT(DATE(2016,1,-3)+(COLUMN()+14)*7,"dd.mm") & " - " & TEXT(DATE(2016,1,1)+(COLUMN()+14)*7,"dd.mm")

    Put the formula in A1 and fill right. If your data doesn't start in column one, you'll need to adjust the "COLUMN + X" portion of the formula to match. "COLUMN + 15" should equal your desired week number and "COLUMN + 14" should be one less.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Generate calendar weeks in cells

    cantosh's formula's use of TEXT is a good insight. If we apply that in my formula it gets much shorter. Note that cantosh's formula is specific to 2016 whereas my formula adapts to whatever is the current year. It is not clear what your needs are.

    ="CW "&COLUMN()&" ("&TEXT(DATE(YEAR(TODAY()),1,1)+(7-WEEKDAY(DATE(YEAR(TODAY()),1,1),12))+7*(COLUMN()-1),"mm.dd")&" - "&TEXT(DATE(YEAR(TODAY()),1,1)+(7-WEEKDAY(DATE(YEAR(TODAY()),1,1),12))+7*(COLUMN()-1)+4,"mm.dd")&")"

  5. #5
    Forum Contributor
    Join Date
    02-18-2013
    Location
    Berlin, Germany
    MS-Off Ver
    Excel 2016
    Posts
    221

    Re: Generate calendar weeks in cells

    Thank you very much for your input! I needed the formular for a planning tool and only for the year 2016. 6StringJazzer thank you very much for your alternative as well!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Generate a calendar
    By Teralian in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-07-2016, 11:13 AM
  2. Replies: 0
    Last Post: 02-27-2013, 07:55 PM
  3. Generate calendar
    By siva1218 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2011, 11:44 PM
  4. Replies: 15
    Last Post: 02-06-2011, 06:13 AM
  5. Formula or macro to generate a date of last weeks Friday
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-29-2011, 10:12 AM
  6. A calendar calculator template that reflects remaing weeks in a ye
    By HR Lost in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-15-2005, 10:54 PM
  7. Create fiscal Year calendar list weeks by #1-52
    By akid12 in forum Excel General
    Replies: 0
    Last Post: 06-14-2005, 07:05 PM

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