c# 一个月中的工作日

Some events occur on the Nth weekday of a specific month each year. Maybe your book club meets on the 4th Tuesday every month, and you don't want to miss any meetings. In Excel, you can use a formula to find the Nth weekday in a month, and there's an example shown below.

某些事件发生在每年特定月份的第N个工作日。 也许您的读书俱乐部每个月的第四个星期二开会,而您不想错过任何会议。 在Excel中,您可以使用公式来查找一个月中的第N个工作日,下面显示了一个示例。

一个月的第N个工作日 (Nth Weekday in a Month)

Aside from your book club, there are other event that always occur on the Nth weekday in a month.

除了您的读书俱乐部,还有其他活动总是在一个月的第N个工作日发生。

For example, here in Canada, we celebrate Victoria Day on the 3rd Monday in May, and in the USA. Thanksgiving is the 4th Thursday in November.

例如,在加拿大,我们将在5月的第三个星期一和美国庆祝维多利亚日。 感恩节是十一月的第四个星期四。

第N个工作日公式 (Nth Weekday Formula)

You can find the "Nth weekday in a month" dates in Excel, using a couple of Excel's  date functions – WEEKDAY and DATE.

您可以使用几个Excel的日期函数WEEKDAY和DATE在Excel中找到“一个月的第N个工作日”日期。

Here's a screen shot of my sample file, with the named ranges that I created.

这是我的示例文件的屏幕截图,其中包含我创建的命名范围 。

Here's the formula in cell C9, to calculate the 4th Thursday in November 2020. The formula uses the defined names, instead of cell references:

这是单元格C9中的公式,用于计算2020年11月的第4个星期四。该公式使用定义的名称,而不是单元格引用:

=DATE(SelYr,SelMth,1 + ((SelN-(SelWD>= WEEKDAY(DATE(SelYr,SelMth,1)))) *7) + (SelWD- WEEKDAY(DATE(SelYr,SelMth,1))))

= DATE(SelYr,SelMth,1 +((SelN-(SelWD> = WEEKDAY(DATE(SelYr,SelMth,1)))))* 7)+(SelWD- WEEKDAY(DATE(SelYr,SelMth,1)))))

NOTE: That formula is based on the late Chip Pearson's nth day example. Chip's site shows the formula, but doesn't explain how it works, so I made a page on my Contextures site, with details.

注意 :该公式基于Chip Pearson已故的第n天示例 。 Chip的网站上显示了该公式,但没有说明其工作原理,因此我在Contextures网站上做了一个页面,并提供了详细信息。

这个怎么运作 (How It Works)

First, the Nth weekday formula calculates the 1st of the month date, with the DATE function.

首先,第N个工作日公式使用DATE函数计算每月的第1个日期。

  • DATE(SelYr,SelMth,1)

    DATE(SelYr,SelMth,1)

It also calculates the weekday number for that month start date, using the WEEKDAY function:

它还使用WEEKDAY函数计算该月开始日期的工作日编号:

  • WEEKDAY(DATE(SelYr,SelMth,1)

    WEEKDAY(DATE(SelYr,SelMth,1)

查找第N次出现 (Find the Nth Occurrence)

Next, the formula checks if the 1st occurrence is in the month's 1st week, by comparing the 1st's weekday number, to the target weekday number.

接下来,该公式通过将第一个工作日的数字与目标工作日数字进行比较,来检查第一个事件是否在月份的第一个星期。

  • If the 1st occurrence is in the 1st week, the formula adds (N-1) * 7 days to the start date如果第一次出现在第一周,则公式将(N-1)* 7天添加到开始日期
  • If the 1st occurrence is NOT in the 1st week, the formula adds (N-0) * 7 days to the start date如果第一次不在第一周,则公式将(N-0)* 7天添加到开始日期

In November 2020, the 1st Thursday is in the 1st week, so 21 days are added, to get to the week with the Nth occurrence:

在2020年11月,第一个星期四在第1周,因此增加了21天,直到出现第N个事件:

  • (4-1) * 7 = 21

    (4-1)* 7 = 21

查找工作日 (Find the Weekday)

Next, the formula adds or subtracts days, based on the weekday numbers.

接下来,公式将根据工作日的数字添加或减去天数。

  • If the target weekday is less than the month start weekday, days are subtracted如果目标工作日小于开始月份的月份,则减去天数
  • If the target weekday is the same as the month start weekday, zero days are added如果目标工作日与月份开始工作日相同,则添加零天
  • If the target weekday is greater than the month start weekday, days are added如果目标工作日大于月份开始的工作日,则添加天数

In November  2020, the 1st is on a Sunday (weekday 1) and the target day is a Thursday (weekday 5). The formula adds 4 days:

2020年11月,第一天是星期日(工作日1),目标日期是星期四(工作日5)。 该公式将增加4天:

  • 5 – 1 = 4

    5 – 1 = 4

第N个工作日公式结果 (Nth Weekday Formula Result)

For November 2020, the 4th Thursday is on the 26th. Here's the formula, with the numbers used to calculate that date:

对于2020年11月,第4个星期四位于26日。 这是公式,其中包含用于计算该日期的数字:

  • 1 + ((4-1) * 7) + 4 = 26

    1 +((4-1)* 7)+ 4 = 26

获取样本文件 (Get the Sample File)

For more details on the formula, and a sample file, go to the Nth Weekday page on my Contextures site.

有关公式和示例文件的更多详细信息,请转到Contextures网站上的“第N个工作日”页面 。

翻译自: https://contexturesblog.com/archives/2020/03/12/find-the-nth-weekday-in-a-month-in-excel/

c# 一个月中的工作日


http://www.taodudu.cc/news/show-4260406.html

相关文章:

  • 一步一步 copy163: 网易严选 ---- vue-cli
  • uniapp网易严选项目
  • android 滑动标签框架,Android实现网易严选标签栏滑动效果
  • ArcGIS Pro 3.0学习版安装教程
  • 学习笔记(03):ArcGIS10.X入门实战视频教程(GIS思维)-坐标系与地理坐标系
  • ArcGIS Pro从0到1入门实战教程 书籍淘宝线上销售,免费下载数据和视频
  • ArcGIS教程:模糊叠加
  • 【转】P2P-BT对端管理协议
  • 自己做网站要买服务器,自己做网站要买服务器
  • 三年级语文计算机之父教学反思,三年级语文教学反思15篇
  • “北大数学系扫地僧” 等十人获奖,均分1000万元,达摩院2021青橙奖出炉
  • 北大韦神等十人获奖,均分1000万元,达摩院2021青橙奖出炉
  • 【历史上的今天】9 月 29 日:“美国支付宝” Stripe 正式上线;HotJava 面世;VR/AR 领域先驱诞生
  • p3.第一章 Python基础入门 -- Python编程基本概念 (三)
  • python——常用的数学计算公式
  • 明日方舟公式计算机,【科普向】明日方舟里的伤害计算公式
  • 西门子plc怎样实现远程调试、远程上下载程序?
  • 调试心得plc做主站(客户端)
  • 西门子S7-1200PLC远程调试方法
  • 西门子1200PLC程序远程上下载,远程在线调试原来是使用了巨控GRM530远程模块
  • plc串口通讯 qt_Qt 编写串口调试助手
  • 三菱 plc远程调试及上下载方法
  • PLC程序的调试方法及步骤
  • 用c语言录入3组学生数据编程,学生信息管理系统C语言编程
  • win10后端开发环境搭建
  • 软件评测师学习整理
  • 系统分析师-2021年下午简答题
  • 【软考 系统架构设计师 简明教程】简介与目录
  • RuntimeError: CUDA error: CUBLAS_STATUS_EXECUTION_FAILED when calling `cublasSgemm( handle, opa, opb
  • 听音测试电脑软件,主观听音测试

c# 一个月中的工作日_在Excel中查找一个月中的第N个工作日相关推荐

  1. excel 替换 换行符_在Excel中查找和替换换行符

    excel 替换 换行符 When you want to create a line break (line feed) in a cell, you press Alt + Enter, to s ...

  2. excel表格计算年龄_在Excel中计算年龄

    excel表格计算年龄 Can you remember how old you are? Or are you like me, and have to ask, "What year i ...

  3. excel共享工作簿_在Excel中避免共享工作簿

    excel共享工作簿 Occasionally a client asks me to create a shared workbook in Excel, so two or more employ ...

  4. python中execute函数_在excel中调用python函数

    效果: 通过excel引用在py文件中写好的load_settle()函数,可以快捷的获取对应的历史结算价. 使用方法: 1.首先安装office,我用的是2016版本. 2.安装python,推荐使 ...

  5. html5 操作excel,html5读取excel表格/在Excel中,一个表格引用另一个表格的数据,用哪些公式进行操作?...

    如何在一个excel表格中获取另一个excel表格中的表格一的表格名并且引用这个表格中的数据? 写代码来实现! 在Excel中,一个表格引用另一个表格的数据,用哪些公式进行操作? 在Excel中,一格 ...

  6. 几张表格怎么联动_在excel 中,怎样实现数据关联?:excel怎么把几个表格的数据联动...

    在excel 中,怎样实现数据关联? Excel数据关联可以利用公式来. 软件版本:Office2007 举例说明如下: 1.Sheet1如下数据,设置Sheet2中对元格数据与之关联起来: 2.在S ...

  7. 将excel中的一个工作表按照某列拆分成多个sheet工作表

    如何将excel中的一个工作表按照某列拆分成多个sheet工作表呢?接下来就利用VBA工具来解决这个问题. 拆分之前的工作表: 拆分之后的工作表: 操作步骤具体如下: 第一步:打开需要拆分的表格文件: ...

  8. excel查找出不来了_在excel中明明表格里有搜索的内容,但搜索不出来。显示的是“找不到正在搜索的数据”...

    1.如图:我们可以清楚看到,我做的这个简单表格中包含"25"这样一个数值.2.下面我们用"查找"的方法,查找一下"25",ctrl+F打开& ...

  9. python 拆分excel单元格_Python怎么在Excel中把一个单元格里的内容拆分提取?:excel表格已拆分的数据提取...

    Python怎么在Excel中把一个单元格里的内容拆分提取? 有规律的话写代码可以处理,没有就没有办法 如何将EXCEL表中的数据分离出来? 如图,B1输入:=LEFT(A1,FIND("排 ...

最新文章

  1. 图形基础 GPU架构(2)软件调用栈
  2. 检查图形是否为真彩色图形
  3. C#中DataGridView控件使用大全
  4. SpringCloud大项目最快速的排查问题的思路
  5. tomcat源码分析_CVE-2020-9484 tomcat session反序列化漏洞分析
  6. 【译】在设计表单的时候应该注意的八点
  7. meteor 结合mysql_Meteor: 关于Template实例(instance)和数据(data)
  8. linux raid
  9. visual studio安装dlib
  10. ubuntu系统下vscode字体显示异常(别扭)
  11. 信息安全-认证技术原理与应用
  12. 基于Java的愤怒的小鸟游戏的设计与实现
  13. gbox推荐源_分享一批自己用的软件源 gbox软件源
  14. java毕业设计源码介绍 基于SSM美好生活九宫格日志网日记网站
  15. 怎么克隆计算机的mac,MAC地址克隆方法
  16. RationalDMIS 2020 最大位置度误差
  17. 基于朴素贝叶斯的兴趣分类
  18. 邮件发送错了怎么办?TOM VIP邮箱如何撤回邮件
  19. java导出excel 复杂的 合并单元格
  20. Java分布式跟踪系统Zipkin(二):Brave源码分析-Tracer和Span

热门文章

  1. GitHub Desktop安装与使用教程
  2. SQL Server 连接字符串和身份验证
  3. uniapp 设置桌面角标
  4. 1.一个整形数组的最大值
  5. 顺序容器迭代器之鄙见
  6. 运维工程师必备的认证【红帽liunx-RHCE 8】
  7. 基于单片机的数字温度计设计
  8. PyQt5 第七章 综合篇(一)
  9. 计算一元二次方程(考虑实根虚根无解)
  10. 旧金山州立大学计算机,旧金山州立大学(San-Francisco-State-University)_彬彬教育...