+ Reply to Thread
Results 1 to 9 of 9

Puzzeling results from calculate number of weeks functions

  1. #1
    Forum Contributor
    Join Date
    10-04-2014
    Location
    Europe
    MS-Off Ver
    2007
    Posts
    107

    Puzzeling results from calculate number of weeks functions

    Hi

    In a recent forum question Billy29 asked for help calculating the number of weeks between two dates and amongst the responses there were 3 answers which appeared to solve the question.

    http://www.excelforum.com/excel-form...-of-weeks.html

    When I tried the posted answers I found one solution gives an accurate week count and the other 2 gave the same incorrect week count, they consistently give a result that is one week to many.

    I am a little confused, I doubt the authors of the two seemingly erroneous answer managed to make significantly different formulas that both result in an identical error... does anyone have a suggestion as to why this could be?

    I have loaded a sheet with all three answers.

    Regards.
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Puzzeling results from calculate number of weeks functions

    Or even:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    which returns 2.

    I think it depends on your interpretation, or even what you need to do with it. For example, do you want to round up or down if you get a partial week? In other words, full weeks elapsed or "worst case" for planning purposes. Clearly, most calculations will return some full weeks and part of a week.

    The calculation will, of course, depend on today's date.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Puzzeling results from calculate number of weeks functions


    A
    B
    C
    D
    E
    1
    2
    If cell B4 contains "r" , C4 should be the number of weeks which have passed since the date from A4
    3
    4
    07/10/2014
    R
    3.00
    Weeks
    =IF(B4="r",WEEKNUM(TODAY(),2)-WEEKNUM(A4,2)+1,"")
    5
    6
    2.00
    Weeks
    =IF(B4="r",ROUND((((YEAR(TODAY())-YEAR(A4))*365+DAY(TODAY())-DAY(A4))/7),1),"Error")
    7
    8
    3.00
    Weeks
    =IF(B4="r",IF((YEAR(A4)=YEAR(TODAY()))*(TODAY()>=A4),WEEKNUM(TODAY(),2)-WEEKNUM(A4,2)+1,IF(YEAR(A4)<YEAR(TODAY()),(WEEKNUM(DATE(YEAR(A4),12,31),2)-WEEKNUM(A4,2))+WEEKNUM(TODAY(),2))),"")
    9
    10
    2.00
    Weeks
    =IF(B4<>"R","",DATEDIF(A4,TODAY(),"d")/7)
    11

  4. #4
    Forum Contributor
    Join Date
    10-04-2014
    Location
    Europe
    MS-Off Ver
    2007
    Posts
    107

    Re: Puzzeling results from calculate number of weeks functions

    If I set the date in cell A4 to 07.10.2014 the 3 formula return; C4 = 3, C6 = 2 and C8 = 3.

    If I set the date in cell A4 to 14.10.2014 the 3 formula return; C4 = 2, C6 = 1 and C8 = 2.


    If I set the date in cell A4 to 08.10.2014 the 3 formula return; C4 = 3, C6 = 1.9 and C8 = 3.


    If I set the date in cell A4 to 07.10.2013 the 3 formula return; C4 = 3, C6 = 53.1 and C8 = 54.

    Is this what others are seeing?
    Last edited by Bobsone; 10-21-2014 at 12:42 PM.

  5. #5
    Forum Contributor
    Join Date
    10-04-2014
    Location
    Europe
    MS-Off Ver
    2007
    Posts
    107

    Re: Puzzeling results from calculate number of weeks functions

    Thanks for your replies TMS.

    I was wondering why 2 of the answers were essentially counting 8 days as 2 weeks, I thought that (perhaps) some aspect of my fiddling with settings was now causing problems in my Excel

    thanks again...

    Regards.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Puzzeling results from calculate number of weeks functions


    A
    B
    C
    D
    E
    F
    G
    12
    Date
    1
    2
    3
    4
    13
    06/10/2014
    R
    3.00
    2.10
    3.00
    2.14
    14
    07/10/2014
    R
    3.00
    2.00
    3.00
    2.00
    15
    14/10/2014
    R
    2.00
    1.00
    2.00
    1.00
    16
    08/10/2014
    R
    3.00
    1.90
    3.00
    1.86
    17
    07/10/2013
    R
    3.00
    54.10
    55.00
    54.14
    18



    Regards, TMS

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Puzzeling results from calculate number of weeks functions

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Puzzeling results from calculate number of weeks functions

    20 posts in that thread and nobody actually defined "the number of weeks passed"

    Once that simple question is answered the solution is trivial (unless you have a very convoluted definition of number of weeks passed).....and it won't involve using WEEKNUM function
    Audere est facere

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Puzzeling results from calculate number of weeks functions

    Well, he says:
    I need to calculate the number of weeks which have passed since a certain day for Project Planning.
    But that doesn't say whether he wants whole or fractional weeks or, if whole weeks, whether to round up or down ... so, whole weeks passed, or whole weeks including the current week.

    He seemed happy with the outcome, but I'm not sure which of the solutions was the one he wanted.

    Regards, TMS

+ 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. [SOLVED] Trying to calculate the number of months AND weeks between two dates..
    By DigitalWavez in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-01-2014, 04:43 PM
  2. Calculate the number of weeks between two dates
    By marsham in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-04-2013, 06:39 PM
  3. Calculate number of weeks
    By tgeorgebglr in forum Excel General
    Replies: 1
    Last Post: 08-06-2007, 05:27 PM
  4. Calculate number of weeks between dates in Excel 2000
    By Darlene in forum Excel General
    Replies: 0
    Last Post: 05-31-2006, 03:45 PM
  5. [SOLVED] HOW TO CALCULATE NUMBER OF WEEKS BETWEEN TWO GIVEN DATES(MAY BE .
    By WARRENCHERYL in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-05-2005, 05:06 AM

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