Excel Formula for dates

hrayani

Well-known Member
Joined
Jul 23, 2010
Messages
1,501
Office Version
  1. 2016
Platform
  1. Windows
Hello Friends,

Kindly have a look at the below and provide a solution

Weekly Calendar NEW.xlsm
BCDEFGHIJK
2
3WEEKLY TARGETSYEAR2017WEEK #1
4
5CATEGORYMondayTuesdayWednesdayThursdayFridaySaturdaySunday
6
7Alpha
8Bravo
9Charlie
10
11Dates required in Range D6:J6 with the following criteria
121) If first day of the month starts on Friday then Monday should show 4th day and should be treated as week # 1
132) If first day of the month starts before Friday then that should be treated as week # 1
143) If user changes year or week # then dates should change considering point number 1 and 2
15
16Example
17Year enterd is 2017 > 1st day of this year is Sunday
18Required Answer if week # 1 is entered
19MondayTuesdayWednesdayThursdayFridaySaturdaySunday
2002 - Jan - 201703 - Jan - 201704 - Jan - 201705 - Jan - 201706 - Jan - 201707 - Jan - 201708 - Jan - 2017
21Required Answer if week # 3 is entered
22MondayTuesdayWednesdayThursdayFridaySaturdaySunday
2316 - Jan - 201717 - Jan - 201718 - Jan - 201719 - Jan - 201720 - Jan - 201721 - Jan - 201722 - Jan - 2017
Weekly Schedule (4)


Regards,

Humayun
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
See this link for formula:

Book1
ABCDEFGHI
1
2WEEKLY TARGETSYEAR2017WEEK #1
3
4CATEGORYMondayTuesdayWednesdayThursdayFridaySaturdaySunday
51/2/20171/3/20171/4/20171/5/20171/6/20171/7/20171/8/2017
Sheet2
Cell Formulas
RangeFormula
C5C5=DATE($F$2,1,-2)-WEEKDAY(DATE($F$2,1,3))+$H$2*7
D5:I5D5=C5+1
 
Upvote 0
Solution
Hello AhoyNC,

I was scratching my head over this for the last 2 days ... and you did it in minutes :)

Thanks a lot

Regards,

Humayun
 
Upvote 0
You're welcome. Glad that worked for you. Thanks for the feedback.
 
Upvote 0
Hello Friends,

Now I will be making a monthly calendar.. I need help with it.

Weekly Calendar Final.xlsx
BCDEFGHI
2MONTHLY TARGETSMonth1YEAR2017
3
4WEEKMondayTuesdayWednesdayThursdayFridaySaturdaySunday
5
6
71234567
8
9891011121314
10
1115161718192021
12
1322232425262728
14
152930311234
16
17
18Dates required in range C5:I5
19In said case Sunday should show 1st Jan 2017 and Saturday should show 31st Dec 2016
20
21Week # required in green cells
Monthly (2)
Cell Formulas
RangeFormula
C7,C15,C13,C11,C9C7=I5+1
D15:I15,D13:I13,D11:I11,D9:I9,D7:I7D7=C7+1


Regards,

Humayun
 
Upvote 0
Hello Friends,

I have figured out the date issue by watching a video on youtube link excel dynamic calendar - Google Search

Now the week part remain pending. I want the week # in range B5:B10

If first day of the year starts on or before Thursday then it should be considered as week # 1 otherwise it should be considered as week 52 or 53 of last year
In below case the second row should show week # 1 and first row should show last week of last year

Weekly Calendar Final.xlsx
BCDEFGHI
2MonthJanuaryYEAR20211-Jan-21
3January 2021
4WEEKSundayMondayTuesdayWednesdayThursdayFridaySaturday
5272829303112
63456789
710111213141516
817181920212223
924252627282930
1031123456
Monthly
Cell Formulas
RangeFormula
I2I2=DATE(H2,VLOOKUP(E2,J4:K10,2,0),1)
B3B3=E2&" "&H2
C5C5=IFERROR(I2-(WEEKDAY(I2)-1),"")
D5:I5D5=IF(C5<>"",C5+1,$I4+1)
C6:C10C6=I5+1
D6:I10D6=C6+1


Any help would be appreciated.

Regards,

Humayun
 
Upvote 0

Forum statistics

Threads
1,215,591
Messages
6,125,711
Members
449,252
Latest member
cryss1988

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