简体   繁体   中英

How do I get weeknum to start counting from a specific date as week 1

Im trying to automate a calendar for a maintenance schedule.

=IF(E$3>=$D5;IF(MOD(E$1-WEEKNUM($D5);INDEX($BG$5:$BG$11;MATCH($C5;$BE$5:$BE$11;0)))=0;$C5;"");"")

is the formula i have in the cells starting from E5 to the end of the year. The numbers in row 1 are the weeknumbers of row 3, and you can see the legend for the frequency table which is housed in be5 to bg11. The problem I'm having is that sometimes the MOD returns 0 before sufficient time has passed leading to situations where the next scheduled maintenance appears to be too soon. I rationalize that if I can stipulate that the date of the last performed maintenance is weeknum 1, then I can make it work. If theres another way I'm not seeing please point it out.

https://imgur.com/a/M4d8KZW

there is a screenshot of what I have currently

Figured it out, at least for my specific issue.

=IF(E$3>=$D5;IF(AND(MOD(E$1-WEEKNUM($D5)+INDEX($BG$5:$BG$20;MATCH($C5;$BE$5:$BE$20;0));INDEX($BG$5:$BG$20;MATCH($C5;$BE$5:$BE$20;0)))=0;WEEKNUM($D5)+INDEX($BG$5:$BG$20;MATCH($C5;$BE$5:$BE$20;0))<=E$1);$C5;"");"")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM