Bi-Weekly Date Calculation

KGee

Well-known Member
Joined
Nov 26, 2008
Messages
537
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am trying to fix formulas I use to calculate a bi-weekly date. The periods are 14 days long and end on a Saturday. The week1 and week2 columns will always be populated for each month. The week3 column should only be populated if the date falls within the current month. The week1 formula should reference the week3 formula from the previous month/row, and when there is no date in week3, it should reference the week2 date from the previous month/row. The week2 formula can always look at week1 from the same month/row.

Below is a sample of the desired output and the formulas I currently have. I need an if statement for week1 and week3 that I can't manage to sort out.
MONTHWEEK1WEEK2WEEK3
2020.JAN2020.JAN.112020.JAN.25
2020.FEB2020.FEB.082020.FEB.22
2020.MAR2020.MAR.072020.MAR.21
2020.APR2020.APR.042020.APR.18
2020.MAY2020.MAY.022020.MAY.162020.MAY.30
2020.JUN2020.JUN.132020.JUN.27
2020.JUL2020.JUL.112020.JUL.25
Code:
WEEK1=UPPER(TEXT(DATE(LEFT(Y2,4),TEXT(MONTH(DATEVALUE(MID(Y2,6,3)&" 1")),"00"),RIGHT(Y2,2))+14,"YYYY.MMM.DD"))
WEEK2=UPPER(TEXT(DATE(LEFT(W3,4),TEXT(MONTH(DATEVALUE(MID(W3,6,3)&" 1")),"00"),RIGHT(W3,2))+14,"YYYY.MMM.DD"))
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Upvote 0
or
=IF(MONTH(E3+14)>MONTH(C3),"",E3+14)
=IF(F3="",E3+14,F3+14)
 
Upvote 0
Thanks Dave. I was able to sort it out in the format I needed.
Code:
WEEK1=IF(Y45="",UPPER(TEXT(DATE(LEFT(X45,4),TEXT(MONTH(DATEVALUE(MID(X45,6,3)&" 1")),"00"),RIGHT(X45,2))+14,"YYYY.MMM.DD")),UPPER(TEXT(DATE(LEFT(Y45,4),TEXT(MONTH(DATEVALUE(MID(Y45,6,3)&" 1")),"00"),RIGHT(Y45,2))+14,"YYYY.MMM.DD")))
WEEK2=UPPER(TEXT(DATE(LEFT(W46,4),TEXT(MONTH(DATEVALUE(MID(W46,6,3)&" 1")),"00"),RIGHT(W46,2))+14,"YYYY.MMM.DD"))
WEEK3=IF(DATE(LEFT(X46,4),TEXT(MONTH(DATEVALUE(MID(X46,6,3)&" 1")),"00"),RIGHT(X46,2))+14>EOMONTH(DATEVALUE(RIGHT(A46,3)&LEFT(A46,4)),0),"",UPPER(TEXT(DATE(LEFT(X46,4),TEXT(MONTH(DATEVALUE(MID(X46,6,3)&" 1")),"00"),RIGHT(X46,2))+14,"YYYY.MMM.DD")))
 
Upvote 0

Forum statistics

Threads
1,215,563
Messages
6,125,568
Members
449,237
Latest member
Chase S

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top