您要查找的公式是:
=DATE(YY, MM, DD) - (WEEKDAY(DATE(YY, MM, DD)) - 1) - 7
// OR
=TODAY() - (WEEKDAY(TODAY()) - 1) - 7
根据您对“上周日”的理解,您可以简化/考虑这一点:
如果您将“上周日”表示为,“最近发生的周日:”
=DATE(A2,B2,C2) - WEEKDAY(DATE(A2,B2,C2)) + 1
如果您将“上周日”表示为,“上一周发生的周日:”
=DATE(A4,B4,C4) - WEEKDAY(DATE(A4,B4,C4)) - 6
解决它:
=TODAY() - (WEEKDAY(TODAY()) - 1) - 7
TODAY()
// get today's date, ie. 22/11/2019
WEEKDAY(TODAY())
// get the current day of the week, ie. 6 (friday)
-
// take the first date and subtract that to rewind through the week,
// ie. 16/11/2019 (last saturday, since saturday is 0)
- 1
// rewind back one less than the entire week
// ie. 17/11/2019 (this sunday)
- 7
// rewind back to the sunday before this
// sunday, ie. 10/11/2019
希望这个解释能解释最后的数字在做什么。 + 1 带你从上周的星期六到本周的星期日(我称之为“这个星期天”),- 6 带你回到上周的我称之为“上星期天”。
请看这里: