跳到主要內容

如何在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”)& “ 天”


具有驚人功能的從租用日期起計算服務時間

您很難記住那麼多公式,但是,如果有 Excel的Kutools,其 日期和時間助手 功能,您可以根據需要快速以年,月,日,年+月+天或其他格式計算服務時間。

注意:要應用此 日期和時間助手,首先,您應該下載 Excel的Kutools,然後快速輕鬆地應用該功能。

安裝後 Excel的Kutools,請這樣做:

1。 單擊要在其中查找結果的單元格,然後單擊 庫工具公式助手 > 日期和時間助手,請參見屏幕截圖:

2。 在 日期和時間助手 對話框中,進行以下操作:

  • 格紋 差異 選項從 類別 部分;
  • 參數輸入 在文本框中,選擇分別包含僱用日期和結束日期的單元格;
  • 然後,根據需要選擇輸出結果類型。 例如,您可以獲取服務年限,以年,月,年+月+天+年,年+月為單位。

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選項卡為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