• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Each time a date changes calculate the number of weeks between it and the next date in the same column

Hello Forum!
I have a long column with dates marking the end of each quarter and I would like a formula that will give me the number of weeks within each quarter.
In B2, I have the formula: =IF(A2<>A1,ROUNDDOWN(A2-A1,1)/7,B1). You can see I've run into a couple of issues. First, B2 and B3 results are not what I want and I can't seem to get the results rounded down to a whole number (no decimals). Thank you in advance for your consideration!

AB
1QuarterWeeks in Quarter
212/31/2020#VALUE!
312/31/2020#VALUE!
43/31/202112.85714286
53/31/202112.85714286
63/31/202112.85714286
73/31/202112.85714286
86/30/202113
96/30/202113
109/30/202113.14285714
119/30/202113.14285714
1212/31/202113.14285714
 
Yodelayheewho
It's a challenge for Excel to calculate 31-Dec-2020 - Quarter in cell B2. (Quarter is text.)
Delete that formula or use iferror-function.
... as well as if A2 = A1 then why cell B2-value should be text like Weeks in Quarter
 
Hi pecoflyer!
I tried your formula and got an error message. It seems to be pointing to the "7". See attached.
 

Attachments

  • Error.jpg
    Error.jpg
    108.4 KB · Views: 4
Hello,
Here are the formulas that are working for me (see attached). In column B, I'm able to calculate the number of WEEKS TO GO for each quarter using the formula: =IF(A2<TODAY(),"",ROUND((DATEDIF(TODAY(),A2,"d")/7),0))
In column G, I'm able to calculate the NUMBER OF WEEKS in each quarter using the formula: =ROUNDDOWN(DATEDIF(E2,F2,"d")/7,0)
Thank you all who responded and provided your insight!
 

Attachments

  • Weeks Between Dates.xlsx
    13.9 KB · Views: 4
Hi pecoflyer!
I tried your formula and got an error message. It seems to be pointing to the "7". See attached.
I forgot to replace the semi colons with a comma ( not everyone uses anglo saxon delimiters)
=IF(TYPE(A1)=2,"",IF(A2<>A1,ROUNDDOWN((A2-A1)/7,0),B1))
 
Updated attached. Now has two sheets. In column B on each sheet are the different formulas. Option 1 is using the formula from vletm and it is working. Unfortunately, the formula from pecoflyer (Option 2) isn't working. As long as I have the one working, I'm happy. Thank you all!
 

Attachments

  • Weeks Between Dates.xlsx
    15.6 KB · Views: 4
Back
Top