跳到主要内容

如何在Excel中从租用日期算起服务期限?

如果您现在拥有一系列数据,包括员工姓名及其在工作表中加入公司的日期,那么现在,您可能要计算他们的服务年限,这意味着要获得员工在公司工作的年数和月数。 本文中,我将为您介绍解决此工作的快速方法。

使用YEARFRAC函数计算从租用日期开始的服务时间

使用DATEDIF函数从租用日期算起服务时间

使用DATEDIF函数计算从租用日期到今天的服务期限

具有惊人功能的从租用日期起计算服务时间


使用YEARFRAC函数计算从租用日期开始的服务时间

要根据租用日期和特定日期计算服务时间,YEARFRAC功能可以为您提供帮助。

请输入以下公式或将其复制到空白单元格中:

=INT(YEARFRAC(B2,C2))

备注:在以上公式中, B2 是雇用日期单元格, C2 是结束日期单元格。

然后拖动填充手柄,将小肠复制到您需要的其他单元格中,您将在几年内获得此人的服务时长。


使用DATEDIF函数从租用日期算起服务时间

如果您需要计算确切年月日中的服务时间,则Excel中的DATEDIF函数可以帮您一个忙。

计算服务年限:

请输入以下公式或将其复制到空白单元格中:

=DATEDIF(B2, C2, "y")& " Years"


计算服务年限,以年和月为单位:

请使用以下公式:

=DATEDIF(B2,C2,"y")&" Years, "&DATEDIF(B2,C2,"ym")&" Months"


计算服务年限,以年,月和日为单位:

应用以下公式:

=DATEDIF(B2,C2,"y") & " Years, " & DATEDIF(B2,C2,"ym") & " Months, " & DATEDIF(B2,C2,"md") & " Days"

备注:在以上公式中, B2 是雇用日期单元格, C2 是结束日期单元格。


使用DATEDIF函数计算从租用日期到今天的服务期限

某些情况下,您可能需要计算从租用日期到今天的服务期限,因此,每天打开工作表时,服务期限都会自动更新。 在这种情况下,您应该在DATEDIF函数中结合使用TODAY函数。

请根据需要应用以下任一公式:

=DATEDIF(B4, TODAY(), "y")& " Years"
= DATEDIF(B4,TODAY(),“ y”)&“年,”&DATEDIF(B4,TODAY(),“ ym”)&“月”
= DATEDIF(B6,TODAY(),“ y”)&“年份”&DATEDIF(B4,TODAY(),“ ym”)&“月,”&DATEDIF(B4,TODAY(),“ md”)& “ 天”


具有惊人功能的从租用日期起计算服务时间

您很难记住那么多公式,但是,如果有 Kutools for Excel,其 日期和时间助手 功能,您可以根据需要快速以年,月,日,年+月+天或其他格式计算服务时间。

请注意:申请这个 日期和时间助手,首先,您应该下载 Kutools for Excel,然后快速轻松地应用该功能。

安装后 Kutools for Excel,请这样做:

1。 单击要在其中查找结果的单元格,然后单击 库工具公式助手 > 日期和时间助手,请参见屏幕截图:

2。 在 日期和时间助手 对话框中,进行以下操作:

  • 单向阀 区别 选项从 Type 部分;
  • 参数输入 在文本框中,选择分别包含雇用日期和结束日期的单元格;
  • 然后,根据需要选择输出结果类型。 例如,您可以获取服务期限,以年,月,年+月+天+年,年+月等为单位。

3。 完成设置后,单击 OK 按钮,您将获得第一个计算结果,然后,只需拖动填充手柄以填充此公式即可测试单元格,现在您将根据需要获得以下结果:

点击下载Kutools for Excel并立即免费试用!


更多相关文章:

  • 计算两个日期之间的天数/工作日/周末数
  • 您是否曾经需要计算过Excel中两个日期之间的天数? 有时,您可能只想计算两个日期之间的工作日,有时,您只需要计算两个日期之间的周末天。 在特定条件下,您如何计算两个日期之间的天数?
  • 计算两个日期之间的天时和分
  • 假设您有两列日期时间单元格,现在,您想要计算这两个日期时间单元格之间的天,小时和分钟之差,如下面的屏幕快照所示。 本文,我将讨论一些为您解决此任务的方法。

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (20)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
First, thank you very much for helping us!

I am trying to use the formula for years and months of service (=DATEDIF(B2,C2,"y")&" Years, "&DATEDIF(B2,C2,"ym")&" Months") which works great, but I would like to add that line and another line that just has numbers in it. Is that possible? For instance: The formula =DATEDIF(B2,C2,"y")&" Years, "&DATEDIF(B2,C2,"ym")&" Months" is located in D2 and I would like to add number of years and months of service from another agency in E2 with the total sum in F2.

All assistance is great appreciated.
Rated 5 out of 5
This comment was minimized by the moderator on the site
If I have a mixed list of employees still with the company (with start date only) and employees no longer with the company (with start and end date), is there a formula for calculating length of service using current date unless there is an end date, in which case the end date would be used in place of the current date to calculate total length of service from start to end?
This comment was minimized by the moderator on the site
what version of Excel can i get this? I am unable to get the function on Excel 2016
This comment was minimized by the moderator on the site
Hello,
The Excel version in the example is Excel 2010. The DATEDIF function is not available in Excel 2013 and later versions.
DATEDIF is not a standard function and hence not part of functions library and so no documentation. Microsoft doesn't promote to use this function as it gives incorrect results in few circumstances.

This function does not appear in the 'Insert Function' dialog box and is not recognised in the 'Function Arguments' dialog box.
The accuracy of this function was improved slightly in Excel 2010 but some of the bugs were never fixed.

Hope it helps. Have a nice day.
Sincerely,
Mandy
This comment was minimized by the moderator on the site
After the years of service has been determined. How do you calculate the persons service computation date (SCD). Is there a formula to subtract the years of service from the persons new appointment date to get their SCD leave date?
This comment was minimized by the moderator on the site
i m in problem; I am new joining to Govt. dept. as Junior Clerk in Accounts site: I want to calculate to make service end period, and after to add extra months years days in service period given by government relaxation period to complete service 9 to 10 years as (the total service is 8 year, 8 months, 18 days) but govt. give 10 months and 28 days to compile the service period for allowing the come in to as pensioner. Thanks to you for solve that problem.
This comment was minimized by the moderator on the site
Dear have a good health to you. I requesting for adjust more months days year in less service length 9 years to make complet 10 years. please tell about it.
This comment was minimized by the moderator on the site
How can I just highlight the cells if the yearly anniversary is within a week? For example They started on 01/10/2020 and I want the start date to be highlighted yellow if the date is 24/09 in each year and then turn red if the anniversary has passed, so turn red 7 days after the 1st?
This comment was minimized by the moderator on the site
Work Services Calculation 1 month different in formula
This comment was minimized by the moderator on the site
If service is 25 Year 07 Months 05 Days than i calculate no. of year and the result is 25, but need to calculate/consider full year if months is equal to 06 months or exceed. After calculation
This comment was minimized by the moderator on the site
For calculating the length of services in years, months and days with start date and end date, I noted that the result for James is 20 days. I would like to confirm if the end date means separation effective date (Day 1 after termination/separation) or last employment date.
Both start (hire date) and end date (last employment date "LED") should be inclusive in the calculation. It is expected to return 21 days but not 20 days as it counted no. of days from 12/11/2025 to 12/31/2025.
How to change the formula? Or should it be used termination effective date (LED + 1 day) as cell C2, instead of input "LED" as end date?
This comment was minimized by the moderator on the site
Florence, you are correct, and the tutorial above is simply wrong. When calculating years of service/length of service, the calculation must be inclusive of the last day worked. Using basic date subtraction formulas tell the *difference* between 2 dates (which will short the length of service by 1 day). For example, if someone stated the 1st, and ended the following day (2nd), taking the date difference would be 1 day (when they actually worked 2 days). Another example: If you use the method above for someone who started work on January 1st, and their last day was December 31st, it will not show that they've worked a complete year -- which is of course an error. The way to get the correct answer is to add +1 to the end date. So, everywhere you see C2 above should be C2+1. This is a significant problem where people everywhere are using this incorrect formula for calculating years of service. The formula is typically correct except the edge case of the last day of employment being the exact day before their start day. I'm in a dispute with my former employer over this very issue. Formulas like this should always be checked for edge cases like worked 1 day, 2 days, worked exactly 1 year, the anniversary date, day before/after, etc. When doing this, you will see all sorts of problems like the one you described.
This comment was minimized by the moderator on the site
Hi, Florence,If you want to include both the start date and end date when calculating, you just need add 1 after the days part as below formula:=DATEDIF(B2,C2,"y") & " Years, " & DATEDIF(B2,C2,"ym") & " Months, " & DATEDIF(B2,C2,"md")+1 & " Days"
Please try, hope it can help you!
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations