Formula to calculate day of the month

Excelteacher21

New Member
Joined
Nov 22, 2021
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Please help a teacher. It's my first year teaching Excel. Found an article where it explains how to calculate Thanksgiving date in any given year using the formula =DATE(Y,M,1+7*Nth)-WEEKDAY(DATE(Y,M,8-DoW). I want to teach this to my students TOMORROW but can't remember why 1+7. Where do we get that or why do we use that? And where do we get the "8" in 8-DoW). All other parts of the formula I understand and can explain to my students. I passed certification in 2013 but my Excel is rusty. If anyone could answer those 2 questions, I'd appreciate it.
 
Thanks! I get all that. What I don’t remember is where we get the “1+7. And in the WEEKDAY part, where do we get the “8”. Everything else makes sense to me.
Because you're looking for the Nth week then you're going to subtract a WEEKDAY, which can have a value from 1 to 7, so the Nth week will be 2-8, 9-15, 16-22, 23-29 and 30-36. If we're looking for the 4th Thursday we'll find it in that 23-29 range, but as we're actually going to subtract a number from 1 to 7 we're looking in a range 22-28.

Each of the ranges has a Mon, Tue, Wed, etc but we want to find which is the Thursday. WEEKDAY default returns a number from 1 to 7 for Sunday through Saturday so we're going to look in that first week, 2-8, based on the day we're looking for. WEEKDAY default for a Thursday returns a 5 but we actually want (I want to say reciprocal but I'm sure that's the wrong mathematical word) so we subtract the 5 from 8 to get 3. Now we get the weekday of November 3rd which is 4 and subtract that from the 29 to get the 25th.

ExcelTeacher21.xlsx
GHIJKLM
3OrdinalDay of WeekWEEKDAY DoWYearMonthResult
44Thu520211125-Nov-21
Sheet1
Cell Formulas
RangeFormula
I4I4=INT(FIND(H4,"SunMonTueWedThuFriSat")/3)+1
M4M4=DATE(J4,K4,1+(7*G4)-WEEKDAY(DATE(J4,K4,8-I4)))
Cells with Data Validation
CellAllowCriteria
G4List1,2,3,4,5
H4ListSun,Mon,Tue,Wed,Thu,Fri,Sat


If you want to set a test then ask how you would change the formula to find the 5th Tuesday but using WEEKDAY with a return_type of 3 (where it returns 0 through 6 for Monday through Sunday).

Hint:
Excel Formula:
=(7*5)-WEEKDAY(DATE(2021,11,7-1),3)
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,214,585
Messages
6,120,397
Members
448,957
Latest member
Hat4Life

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