Excel WEEKDAY function
WEEKDAY 把日期转成星期数字,用来判断周末、算某个日期是周几。最容易出错的是 return_type:默认 1 表示周日=1、周六=7,而很多人以为是周一开头。中文习惯「周一=1」要传 2。
日期与时间 · 适用版本: Excel 2007(return_type 11–17 从 2010 起)
语法
WEEKDAY(serial_number, [return_type])返回什么 日期是星期几,以数字表示(含义取决于 return_type)。
| 参数 | ||
|---|---|---|
| serial_number | 必填 | 日期。 |
| return_type | 可选 | 1/省略 = 周日1–周六7;2 = 周一1–周日7;3 = 周一0–周日6;11–17 是更多变体。 |
示例
判断是不是周末
| Date | Weekend? |
| 2026-11-21 | |
| 2026-11-24 |
= IF(WEEKDAY(A2,2)>5,"Yes","No")→ Yes
2026-11-21 是周六。用 return_type=2 时周一是 1、周日是 7,所以「大于 5」就是周六周日。如果用默认的 1,周六是 7、周日是 1,条件得写成 OR(WEEKDAY(A2)=1,WEEKDAY(A2)=7)。
算距离周六还有几天
| Today | Days to Saturday |
| 2026-11-26 |
= 6-WEEKDAY(A2,2)→ 2
2026-11-26 是周四。return_type=2 时周一是 1、周六是 6,所以 6-WEEKDAY(A2,2) 得到 2——周六是 11-28。周五会得到 1,周六得到 0,周日是负数,正好能用来判断「这周还剩几天班」。
常见错误
- 1.默认 return_type 的周日=1 让人算错周末判断,统一传 2 最省心。
- 2.在条件格式里用 WEEKDAY 忘了参数,结果周六没被标出来。
- 3.以为 WEEKDAY 能处理文本日期,返回 #VALUE!。
怎么用
- 1.点一下要放结果的单元格。
- 2.输入 = 再输入函数名,按 Tab 接受。
- 3.参数用逗号分隔;区域可以直接用鼠标拖选。
- 4.回车确认。同样的公式要用在下面的行,就拖填充柄。
常见问题
What is the syntax of WEEKDAY?
WEEKDAY(serial_number, [return_type]). 返回什么: 日期是星期几,以数字表示(含义取决于 return_type)。
Which Excel versions support WEEKDAY?
Excel 2007(return_type 11–17 从 2010 起). It is available in every desktop version unless the note above says otherwise.
Why does WEEKDAY return an error instead of a value?
默认 return_type 的周日=1 让人算错周末判断,统一传 2 最省心。