Formula To Fill In Days Based On Starting And Ending Dates

JEF13

New Member
Joined
Jun 30, 2018
Messages
49
Office Version
  1. 2019
I am looking for a formula that will automatically fill in the day of the week based on the start and end date. The formula is used in a series of cells. Please refer to the screenshot.
As an example, the starting date in L1 is 7/1/2022 and the ending date in L2 is 7/13/2022.

Cell B1 displays Friday
Cell B2 displays Saturday
...
Cell B14 displays Friday
Cell H14 displays nothing

Thank you!

Jeffrey
 

Attachments

  • Screenshot.png
    Screenshot.png
    23 KB · Views: 18

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Jef, Let's get the ball rollin. Now I know you asked for a formula and here is a program, but we have to start some place. So usually this generates more questions than answers so let the discussion begin. If you have any questions let us know.

VBA Code:
Sub Prog1()

Dim Date1 As Long
Dim Loop1 As Long
Dim Col1 As Long
Dim Col2 As Long
Dim Add1 As Long

 Range("B2:H2,B14:H14").Select
    Range("B14").Activate
    Selection.Clear
    Range("B2").Select
    
Date1 = Range("M2") - Range("M1")
Row1 = 2

Col1 = 2
Col2 = 2
Add1 = 0

For Loop1 = 2 To Date1 + 2

If Col1 <= 8 Then

    Cells(2, Col1).Select
    Cells(2, Col1).Formula = "=M1" & " +  " & Add1 & ""
    Cells(2, Col1).NumberFormat = "DDDD"
    Col1 = Col1 + 1
    Add1 = Add1 + 1

Else

    Cells(14, Col2).Select
    Cells(14, Col2).Formula = "=M1" & " +  " & Add1 & ""
    Cells(14, Col2).NumberFormat = "DDDD"
    Add1 = Add1 + 1
    Col2 = Col2 + 1

End If

Next Loop1
End Sub


22-06-11 3.xlsm
BCDEFGHIJKLM
17/1/2022
2FridaySaturdaySundayMondayTuesdayWednesdayThursday7/11/2022
3
4
5
6
7
8
9
10
11
12
13
14FridaySaturdaySundayMonday
Date
Cell Formulas
RangeFormula
B2B2=M1 + 0
C2C2=M1 + 1
D2D2=M1 + 2
E2E2=M1 + 3
F2F2=M1 + 4
G2G2=M1 + 5
H2H2=M1 + 6
B14B14=M1 + 7
C14C14=M1 + 8
D14D14=M1 + 9
E14E14=M1 + 10
 
Upvote 0
Thanks for your time and effort. Much appreciated. I will go through the information nd reach out with any questions!

Thanks.

Jeffrey
 
Upvote 0
Jef, I did some more thinking on your problem and here is a worksheet that just uses a formula to get the results you want. Now the only thing is you have to format the cells using custom format and DDDD.

Cell Formulas
RangeFormula
B2B2=IF(M2-M1>= 0,M1 + 0,"")
C2C2=IF(M2-M1>= 1,M1 + 1,"")
D2D2=IF(M2-M1>= 2,M1 + 2,"")
E2E2=IF(M2-M1>= 3,M1 + 3,"")
F2F2=IF(M2-M1>= 4,M1 + 4,"")
G2G2=IF(M2-M1>= 5,M1 + 5,"")
H2H2=IF(M2-M1>= 6,M1 + 6,"")
N1:N2N1=M1
B14B14=IF(M2-M1>= 7,M1 + 7,"")
C14C14=IF(M2-M1>=8,M1 + 8,"")
D14D14=IF(M2-M1>=9,M1 + 9,"")
E14E14=IF(M2-M1>=10,M1 + 10,"")
F14F14=IF(M2-M1>=11,M1 + 11,"")
G14G14=IF(M2-M1>=12,M1 + 12,"")
H14H14=IF(M2-M1>=13,M1 + 13,"")
 
Upvote 0
Great work on simplifying the solution to be a formula only. Thank you! The new solution is great.
 
Upvote 0
Hi everyone. Something has changed with the behavior of the spreadsheet and I'm not sure how to fix it. What's going on is that unless there misinformation of guests up to cell 217 the dates and guest names aren't automatically filled in. So in other words, if the guest list goes up to 84 the system doesn't fill in all 84 guest names. It's only when the guest names go up to 102 does the system fully work. There's been a slight change in the formulas as I put the spreadsheet in Google Sheets for easy team access. Any insights as to how to correct the issues is appreciated. I've pasted the relevant parts of the spread sheet below. Thank you in advance for your help.

Podcast Tracker 2023.xlsx
ABC
1GuestDateEpisode
2Guest 1Tue 01/03/20230191
3Guest 2Thu 01/05/20230192
4Guest 3Tue 01/10/20230193
5Guest 4Thu 01/12/20230194
6Internal Show 1Tue 01/17/20230195
7Guest 5Thu 01/19/20230196
8Guest 6Tue 01/24/20230197
9Guest 7Thu 01/26/20230198
10Guest 8Tue 01/31/20230199
11Internal Show 2Thu 02/02/20230200
12Guest 9Tue 02/07/20230201
13Guest 10Thu 02/09/20230202
14Guest 11Tue 02/14/20230203
15Guest 12Thu 02/16/20230204
16Internal Show 3Tue 02/21/20230205
17Guest 13Thu 02/23/20230206
18Guest 14Tue 02/28/20230207
19Guest 15Thu 03/02/20230208
20Guest 16Tue 03/07/20230209
21Internal Show 4Thu 03/09/20230210
22Guest 17Tue 03/14/20230211
23Guest 18Thu 03/16/20230212
24Guest 19Tue 03/21/20230213
25Guest 20Thu 03/23/20230214
26Internal Show 5Tue 03/28/20230215
27Guest 21Thu 03/30/20230216
28Guest 22Tue 04/04/20230217
29Guest 23Thu 04/06/20230218
30Guest 24Tue 04/11/20230219
31Internal Show 6Thu 04/13/20230220
32Guest 25Tue 04/18/20230221
33Guest 26Thu 04/20/20230222
34Guest 27Tue 04/25/20230223
35Guest 28Thu 04/27/20230224
36Internal Show 7Tue 05/02/20230225
37Guest 29Thu 05/04/20230226
38Guest 30Tue 05/09/20230227
39Guest 31Thu 05/11/20230228
40Guest 32Tue 05/16/20230229
41Internal Show 8Thu 05/18/20230230
42Guest 33Tue 05/23/20230231
43Guest 34Thu 05/25/20230232
44Guest 35Tue 05/30/20230233
45Guest 36Thu 06/01/20230234
46Internal Show 9Tue 06/06/20230235
47Guest 37Thu 06/08/20230236
48Guest 38Tue 06/13/20230237
49Guest 39Thu 06/15/20230238
50Guest 40Tue 06/20/20230239
51Internal Show 10Thu 06/22/20230240
52Guest 41Tue 06/27/20230241
53Guest 42Thu 06/29/20230242
54Guest 43Tue 07/04/20230243
55Guest 44Thu 07/06/20230244
56Internal Show 11Tue 07/11/20230245
57Guest 45Thu 07/13/20230246
58Guest 46Tue 07/18/20230247
59Guest 47Thu 07/20/20230248
60Guest 48Tue 07/25/20230249
61Internal Show 12Thu 07/27/20230250
62Guest 49Tue 08/01/20230251
63Guest 50Thu 08/03/20230252
64Guest 51Tue 08/08/20230253
65Guest 52Thu 08/10/20230254
66Internal Show 13Tue 08/15/20230255
67Guest 53Thu 08/17/20230256
68Guest 54Tue 08/22/20230257
69Guest 55Thu 08/24/20230258
70Guest 56Tue 08/29/20230259
71Internal Show 14Thu 08/31/20230260
72Guest 57Tue 09/05/20230261
73Guest 58Thu 09/07/20230262
74Guest 59Tue 09/12/20230263
75Guest 60Thu 09/14/20230264
76Internal Show 15Tue 09/19/20230265
77Guest 61Thu 09/21/20230266
78Guest 62Tue 09/26/20230267
79Guest 63Thu 09/28/20230268
80Guest 64Tue 10/03/20230269
81Internal Show 16Thu 10/05/20230270
82Guest 65Tue 10/10/20230271
83Guest 66Thu 10/12/20230272
84Guest 67Tue 10/17/20230273
85Guest 68Thu 10/19/20230274
86Internal Show 17Tue 10/24/20230275
87Guest 69Thu 10/26/20230276
88Guest 70Tue 10/31/20230277
89Guest 71Thu 11/02/20230278
90Guest 72Tue 11/07/20230279
91Internal Show 18Thu 11/09/20230280
92Guest 73Tue 11/14/20230281
93Guest 74Thu 11/16/20230282
94Guest 75Tue 11/21/20230283
95Guest 76Thu 11/23/20230284
96Internal Show 19Tue 11/28/20230285
97Guest 77Thu 11/30/20230286
98Guest 78Tue 12/05/20230287
99Guest 79Thu 12/07/20230288
100Guest 80Tue 12/12/20230289
101Internal Show 20Thu 12/14/20230290
102Guest 81Thu 12/21/20230291
103Guest 82Thu 12/28/20230292
Master Spreadsheet For Podcast
Cell Formulas
RangeFormula
A2A2=IF(B2="","",IF(AND(MOD(ROW()-1,$Q$113)=0,SUMPRODUCT(SIGN(COUNTIF($L$114:$L$199,$A$1:$A1)))<COUNTA($L$114:$L$199)),INDEX($L$114:$L$199,SUMPRODUCT(SIGN(COUNTIF($L$114:$L$199,$A$1:$A1)))+1),INDEX($J$114:$J$199,SUMPRODUCT(SIGN(COUNTIF($J$114:$J$199,$A$1:$A1)))+1)))
A3:A103A3=IF(B3="","",IF(AND(MOD(ROW()-1,$Q$113)=0,SUMPRODUCT(SIGN(COUNTIF($L$114:$L$217,$A$1:$A2)))<COUNTA($L$114:$L$217)),INDEX($L$114:$L$217,SUMPRODUCT(SIGN(COUNTIF($L$114:$L$217,$A$1:$A2)))+1),INDEX($J$114:$J$217,SUMPRODUCT(SIGN(COUNTIF($J$114:$J$217,$A$1:$A2)))+1)))
B3:B103B3=IF(ROWS(B$2:B3)>COUNTA($J$114:$J$217)+MIN(COUNTA($K$127:$K$217),$M$114),"",WORKDAY.INTL(B2,1,IF(ROWS(B$2:B3)>2*(COUNTA($J$114:$J$217)+MIN(COUNTA($K$127:$K$217),$M$114)-52),"1110111","1010111")))
C3:C103C3=IF(LEN(A3)>1,C2+1,"")
Press CTRL+SHIFT+ENTER to enter array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A112,E113,A200:A1000Cell Valuecontains "Internal"textNO


Podcast Tracker 2023.xlsx
HIJKLMNOPQ
113DateGuestsEmailInternal# of Internal Shows NeededNumber of Internal Shows Every N Weeks5
114Guest 1Internal Show 121
115Guest 2Internal Show 2
116Guest 3Internal Show 3
117Guest 4Internal Show 4Not enough internal shows - filling with guests
118Guest 5Internal Show 5
119Guest 6Internal Show 6
120Guest 7Internal Show 7
121Guest 8Internal Show 8
122Guest 9Internal Show 9
123Guest 10Internal Show 10
124Guest 11Internal Show 11
125Guest 12Internal Show 12
126Guest 13Internal Show 13
127Guest 14Internal Show 14
128Guest 15Internal Show 15
129Guest 16Internal Show 16
130Guest 17Internal Show 17
131Guest 18Internal Show 18
132Guest 19Internal Show 19
133Guest 20Internal Show 20
134Guest 21Internal Show 21
135Guest 22
136Guest 23
137Guest 24
138Guest 25
139Guest 26
140Guest 27
141Guest 28
142Guest 29
143Guest 30
144Guest 31
145Guest 32
146Guest 33
147Guest 34
148Guest 35
149Guest 36
150Guest 37
151Guest 38
152Guest 39
153Guest 40
154Guest 41
155Guest 42
156Guest 43
157Guest 44
158Guest 45
159Guest 46
160Guest 47
161Guest 48
162Guest 49
163Guest 50
164Guest 51
165Guest 52
166Guest 53
167Guest 54
168Guest 55
169Guest 56
170Guest 57
171Guest 58
172Guest 59
173Guest 60
174Guest 61
175Guest 62
176Guest 63
177Guest 64
178Guest 65
179Guest 66
180Guest 67
181Guest 68
182Guest 69
183Guest 70
184Guest 71
185Guest 72
186Guest 73
187Guest 74
188Guest 75
189Guest 76
190Guest 77
191Guest 78
192Guest 79
193Guest 80
194Guest 81
195Guest 82
196Guest 83
197Guest 84
198Guest 85
199Guest 86
200Guest 87Guest 87 Guest 88
201Guest 88
202Guest 89Guest 89 Guest 90
203Guest 90
204Guest 91Guest 91 Guest 92
205Guest 92
206Guest 93Guest 93 Guest 94
207Guest 94
208Guest 95Guest 95 Guest 96
209Guest 96
210Guest 97Guest 97 Guest 98
211Guest 98
212Guest 99Guest 99 Guest 100
213Guest 100
214Guest 101Guest 101 Guest 102
215Guest 102
216 
217
Master Spreadsheet For Podcast
Cell Formulas
RangeFormula
M114M114=INT((COUNTA(J114:K199)-1)/(Q113-1))
M117M117=IF(COUNTA(J114:K199)>104,"Too many shows scheduled for 1 year",IF(COUNTA(K127:K199)<M114,"Not enough internal shows - filling with guests",""))
O200,O216,O214,O212,O210,O208,O206,O204,O202O200=IF(J200>0,J200&" "&J201,"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
M113Expression=$K113="Y"textNO
J117:J127,J130:J139,J143:J152,J156:J165,J169:J172,J176:J186,J189:J224,J228:J231,J235:J245,J248:J257,J261:J270,J274:J283,J287:J290,J294:J304,J307:J316,J320:J329,J333:J342,J346:J349,J353:J363,J366:J373Cell Valuecontains "JeffreyEpisode"textNO
L116Cell Valuecontains "JeffreyEpisode"textNO
L115,L117,L119,L121,L123,L125,K127,K129,K131,K133,K135,K137,K139,K141,K143,K145Cell Valuecontains "JeffreyEpisode"textNO
J135:J139,J194:J215,J253:J257,J312:J316,J371:J373Cell Valuecontains "JeffreyEpisode"textNO
J147:J152,J206:J211,J265:J270,J324:J329Cell Valuecontains "JeffreyEpisode"textNO
J143:J148,J202:J215,J261:J266,J320:J325Cell Valuecontains "JeffreyEpisode"textNO
J140:J144,J199:J203,J258:J262,J317:J321Cell Valuecontains "JeffreyEpisode"textNO
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

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