excel - Determine the month of a week based on in which month a certain weekday is? -
excel - Determine the month of a week based on in which month a certain weekday is? -
i want user come in year a1.
i want user come in week number a2.
i want user come in weekday (monday, tuesday, wednesday, thursday, friday, saturday or sunday) in a3.
then want a4 calculate month of entered week number weeks counted belonging month depending on if specified weekday in month or not.
what formula work in a4? (if can not solve problem, can give me formula works if specified weekday can thursday, welcome well.
my thought that:
(weeknumber-1)*7 + weekday -> mon = 1, tue = 2.... check day of year [0..365 or 366] , compare offset jan / feb / march... depending on whether year has 29th of feb - can calculated using year.
now have convert code.
edit: after read page reffered to, assume have problem understanding excels date syntax http://office.microsoft.com/en-us/excel-help/date-function-hp010062283.aspx
so lets break code down: happens here?
=choose(month(date(a2,1,b2*7-2)-weekday(date(b2,1,3))),"january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december")
so lets pick first date statement: date (as stated in microsoft's doc) works follows: if month has more 30/31 days leftover days dragged next month. a1 year (yyyy/mm/dd) b2 day times 7 == weeknumber minus offset because first week shall not counted (like week 1 day 3 formula create day 10 otherwise)
** https://support.office.com/en-us/article/weekday-function-a9784177-5c31-4deb-bc9e-d4ab914983ca?ui=en-us&rs=en-us&ad=us
** same month https://support.office.com/en-us/article/month-function-eedac31a-e28c-46fb-b81f-cadb4bc03751?ui=en-us&rs=en-us&ad=us
so monthnames? well, sinmple enumeration , take function in origin convert number between 0...x value @ corresponding place in enum, why months have in order.
excel excel-formula
Comments
Post a Comment