Another nth day fill question, show every Tuesday in a month accounting for Feb

dallenk

New Member
Joined
Jan 20, 2017
Messages
23
Office Version
  1. 365
Platform
  1. Windows
once again I am here for help, I've read hundreds of tutorials on how to fill dates, get every 1st and 3rd day, every Monday ect ect.. but none of them seem to account for the 28 or 29 days in February..
In my sheets, the month is pulled from the sheet name, then converted to a number, the year is referenced from another sheet, and with some fancy (but likely clumsily formulated) math I am able to fill cells with the number of each Tuesday in the month. My problem now, is February does not have more than 28 days (29 on leapyear) and this is where my issue is. There must be an easier way to do this, I have a feeling I overcomplicated things as this sheet evolved over the years.

Is there a more elegant modification or function that can account for less than 30 days for Feb?

Book2.xlsx
BCDEFGHI
4tuesdays as day
520211st2nd3rd4th5th
6jan15121926 
7feb229162330
8mar329162330
JAN
Cell Formulas
RangeFormula
E6:E8E6=(DAY(DATE($B$5,$C6,8)-WEEKDAY(DATE($B$5,$C6,5))))
F6:I8F6=@IFERROR(IF(E6,IF(E6>(31-7),B,SUM(E6+7)),x),"")
C6:C8C6=MONTH(DATEVALUE(B6&" 1, "&$B$5))



My alternative "solution" (if it can be called one) is to put in a clumsy IF check to see if the month is feb and modify the math a little to account for it.

Book2.xlsx
KLMNOPQR
4tuesdays as day with an IF
520211st2nd3rd4th5th
6jan15121926 
7feb2291623 
8mar329162330
JAN
Cell Formulas
RangeFormula
N6:N8N6=(DAY(DATE($K$5,$L6,8)-WEEKDAY(DATE($K$5,$L6,5))))
O6:R8O6=IF($L6=2,@IFERROR(IF(N6,IF(N6>(29-7),B,SUM(N6+7)),x),""),@IFERROR(IF(N6,IF(N6>(31-7),B,SUM(N6+7)),x),""))
L6:L8L6=MONTH(DATEVALUE(K6&" 1, "&$K$5))



Open to any suggestions or alternative solutions... maybe this can help someone else.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Assuming that your column E formula is working correctly (I haven't checked) then try this in F6 copied across and down.

21 12 04.xlsm
BCDEFGHI
4tuesdays as day
520211st2nd3rd4th5th
6jan15121926 
7feb2291623 
8mar329162330
Dates
Cell Formulas
RangeFormula
E6:E8E6=(DAY(DATE($B$5,$C6,8)-WEEKDAY(DATE($B$5,$C6,5))))
F6:I8F6=IF(MONTH(DATE($B$5,$C6,E6+7))=$C6,E6+7,"")
 
Upvote 0
Solution
That works perfectly, and much cleaner than what I had. Thank you very much!
This place is amazing.
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,702
Members
449,048
Latest member
81jamesacct

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