ไปยังเนื้อหาหลัก

จะคำนวณระยะเวลาการให้บริการจากวันที่จ้างใน Excel ได้อย่างไร?

หากคุณมีข้อมูลจำนวนหนึ่งรวมถึงชื่อพนักงานและวันที่เข้าร่วม บริษัท ของคุณในแผ่นงานตอนนี้คุณอาจต้องการคำนวณระยะเวลาการทำงานของพวกเขานั่นหมายถึงจำนวนปีและเดือนที่พนักงานทำงานใน บริษัท ของคุณ บทความนี้ฉันจะพูดถึงวิธีการด่วนในการแก้ปัญหานี้สำหรับคุณ

คำนวณระยะเวลาการให้บริการจากวันที่จ้างด้วยฟังก์ชัน YEARFRAC

คำนวณระยะเวลาการให้บริการจากวันที่จ้างด้วยฟังก์ชัน DATEDIF

คำนวณระยะเวลาการให้บริการจากวันที่จ้างถึงวันนี้ด้วยฟังก์ชัน DATEDIF

คำนวณระยะเวลาการให้บริการจากวันที่จ้างด้วยคุณสมบัติที่น่าทึ่ง


คำนวณระยะเวลาการให้บริการจากวันที่จ้างด้วยฟังก์ชัน YEARFRAC

ในการคำนวณระยะเวลาการให้บริการจากวันที่จ้างและวันที่ที่ระบุฟังก์ชัน YEARFRAC สามารถช่วยคุณได้

โปรดป้อนหรือคัดลอกสูตรต่อไปนี้ลงในเซลล์ว่าง:

=INT(YEARFRAC(B2,C2))

หมายเหตุ: ในสูตรข้างต้น B2 คือเซลล์วันที่เช่าและ C2 คือเซลล์วันที่สิ้นสุด

จากนั้นลากที่จับเติมเพื่อคัดลอก fromula ไปยังเซลล์อื่น ๆ ที่คุณต้องการและคุณจะได้รับความยาวของบุคคลนั้นในปี


คำนวณระยะเวลาการให้บริการจากวันที่จ้างด้วยฟังก์ชัน DATEDIF

หากคุณต้องการคำนวณระยะเวลาในการให้บริการเป็นปีเดือนและวันที่แน่นอนฟังก์ชัน DATEDIF ใน Excel สามารถช่วยคุณได้

คำนวณระยะเวลาการให้บริการเป็นปี:

โปรดป้อนหรือคัดลอกสูตรต่อไปนี้ลงในเซลล์ว่าง:

=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

บางเรื่องคุณอาจต้องการคำนวณระยะเวลาการให้บริการตั้งแต่วันที่จ้างจนถึงวันนี้ดังนั้นทุกวันที่คุณเปิดแผ่นงานความยาวของบริการจะได้รับการอัปเดตโดยอัตโนมัติ ในกรณีนี้คุณควรรวมฟังก์ชัน TODAY ไว้ในฟังก์ชัน DATEDIF

โปรดใช้สูตรใดสูตรหนึ่งด้านล่างตามความต้องการของคุณ:

=DATEDIF(B4, TODAY(), "y")& " Years"
= DATEDIF (B4, TODAY (), "y") & "Years," & DATEDIF (B4, TODAY (), "ym") & "Months"
= DATEDIF (B6, TODAY (), "y") & "Years," & DATEDIF (B4, TODAY (), "ym") & "Months," & DATEDIF (B4, TODAY (), "md") & "วัน"


คำนวณระยะเวลาการให้บริการจากวันที่จ้างด้วยคุณสมบัติที่น่าทึ่ง

มันค่อนข้างยากสำหรับคุณที่จะจำสูตรต่างๆมากมาย แต่ถ้าคุณมี Kutools สำหรับ Excelเดียวกันกับที่ ตัวช่วยวันที่และเวลา คุณสามารถคำนวณระยะเวลาการให้บริการเป็นปีเดือนวันปี + เดือน + วันหรือรูปแบบอื่น ๆ ได้อย่างรวดเร็วตามที่คุณต้องการ

หมายเหตุที่จะใช้สิ่งนี้ ตัวช่วยวันที่และเวลาประการแรกคุณควรดาวน์โหลดไฟล์ Kutools สำหรับ Excelแล้วใช้คุณสมบัตินี้อย่างรวดเร็วและง่ายดาย

หลังจากการติดตั้ง Kutools สำหรับ Excelโปรดทำตามนี้:

1. คลิกเซลล์ที่คุณต้องการค้นหาผลลัพธ์จากนั้นคลิก Kutoolsตัวช่วยสูตร > ตัวช่วยวันที่และเวลาดูภาพหน้าจอ:

2. ใน ตัวช่วยวันที่และเวลา ไดอะล็อกบ็อกซ์ให้ดำเนินการดังต่อไปนี้:

  • ตรวจสอบ ความแตกต่าง ตัวเลือกจาก ชนิดภาพเขียน มาตรา;
  • ตัว Vortex Indicator ได้ถูกนำเสนอลงในนิตยสาร การป้อนอาร์กิวเมนต์ กล่องข้อความเลือกเซลล์ที่มีวันที่จ้างและวันที่สิ้นสุดแยกกัน
  • จากนั้นเลือกประเภทผลลัพธ์ตามที่คุณต้องการ ตัวอย่างเช่นคุณจะได้รับอายุราชการเป็นปีเดือนปี + เดือน + วันปี + เดือนและอื่น ๆ

3. หลังจากเสร็จสิ้นการตั้งค่าคลิก OK และคุณจะได้ผลลัพธ์จากการคำนวณครั้งแรกจากนั้นคุณเพียงแค่ลากจุดจับเติมเพื่อเติมสูตรนี้เพื่อทดสอบเซลล์และตอนนี้คุณจะได้ผลลัพธ์ต่อไปนี้ตามที่คุณต้องการ:

คลิกเพื่อดาวน์โหลด Kutools สำหรับ Excel และทดลองใช้ฟรีทันที!


บทความที่เกี่ยวข้องเพิ่มเติม:

  • นับจำนวนวัน / วันทำงาน / วันหยุดสุดสัปดาห์ระหว่างสองวัน
  • คุณเคยต้องนับจำนวนวันระหว่างวันที่สองวันใน Excel หรือไม่? บางครั้งคุณแค่ต้องการคำนวณวันทำงานระหว่างวันที่สองวันและบางครั้งคุณต้องนับวันหยุดสุดสัปดาห์ระหว่างวันที่สองวันเท่านั้น คุณจะนับจำนวนวันระหว่างวันที่สองวันในเงื่อนไขบางอย่างได้อย่างไร?
  • คำนวณวันชั่วโมงและนาทีระหว่างวันที่สองวัน
  • สมมติว่าคุณมีสองคอลัมน์ของเซลล์เวลาวันที่และตอนนี้คุณต้องการคำนวณความแตกต่างของวันชั่วโมงและนาทีระหว่างเซลล์เวลาวันที่ทั้งสองนี้ตามภาพหน้าจอต่อไปนี้ บทความนี้ฉันจะพูดถึงวิธีการบางอย่างในการแก้ปัญหานี้ให้คุณ

สุดยอดเครื่องมือเพิ่มผลผลิตในสำนักงาน

🤖 Kutools AI ผู้ช่วย: ปฏิวัติการวิเคราะห์ข้อมูลโดยยึดตาม: การดำเนินการที่ชาญฉลาด   |  สร้างรหัส  |  สร้างสูตรที่กำหนดเอง  |  วิเคราะห์ข้อมูลและสร้างแผนภูมิ  |  เรียกใช้ฟังก์ชัน Kutools...
คุณสมบัติยอดนิยม: ค้นหา เน้น หรือระบุรายการที่ซ้ำกัน   |  ลบแถวว่าง   |  รวมคอลัมน์หรือเซลล์โดยไม่สูญเสียข้อมูล   |   รอบโดยไม่มีสูตร ...
การค้นหาขั้นสูง: VLookup หลายเกณฑ์    VLookup หลายค่า  |   VLookup ข้ามหลายแผ่น   |   การค้นหาที่ไม่ชัดเจน ....
รายการแบบเลื่อนลงขั้นสูง: สร้างรายการแบบหล่นลงอย่างรวดเร็ว   |  รายการแบบหล่นลงขึ้นอยู่กับ   |  เลือกหลายรายการแบบหล่นลง ....
ผู้จัดการคอลัมน์: เพิ่มจำนวนคอลัมน์เฉพาะ  |  ย้ายคอลัมน์  |  สลับสถานะการมองเห็นของคอลัมน์ที่ซ่อนอยู่  |  เปรียบเทียบช่วงและคอลัมน์ ...
คุณสมบัติเด่น: กริดโฟกัส   |  มุมมองการออกแบบ   |   บาร์สูตรใหญ่    สมุดงานและตัวจัดการชีต   |  ห้องสมุดทรัพยากร (ข้อความอัตโนมัติ)   |  เลือกวันที่   |  รวมแผ่นงาน   |  เข้ารหัส/ถอดรหัสเซลล์    ส่งอีเมลตามรายการ   |  ซุปเปอร์ฟิลเตอร์   |   ตัวกรองพิเศษ (กรองตัวหนา/ตัวเอียง/ขีดทับ...) ...
ชุดเครื่องมือ 15 อันดับแรก12 ข้อความ เครื่องมือ (เพิ่มข้อความ, ลบอักขระ, ... )   |   50 + แผนภูมิ ประเภท (แผนภูมิ Gantt, ... )   |   40+ ใช้งานได้จริง สูตร (คำนวณอายุตามวันเกิด, ... )   |   19 การแทรก เครื่องมือ (ใส่ QR Code, แทรกรูปภาพจากเส้นทาง, ... )   |   12 การแปลง เครื่องมือ (ตัวเลขเป็นคำ, การแปลงสกุลเงิน, ... )   |   7 ผสานและแยก เครื่องมือ (แถวรวมขั้นสูง, แยกเซลล์, ... )   |   ... และอื่น ๆ

เพิ่มพูนทักษะ Excel ของคุณด้วย Kutools สำหรับ Excel และสัมผัสประสิทธิภาพอย่างที่ไม่เคยมีมาก่อน Kutools สำหรับ Excel เสนอคุณสมบัติขั้นสูงมากกว่า 300 รายการเพื่อเพิ่มประสิทธิภาพและประหยัดเวลา  คลิกที่นี่เพื่อรับคุณสมบัติที่คุณต้องการมากที่สุด...

รายละเอียด


แท็บ Office นำอินเทอร์เฟซแบบแท็บมาที่ Office และทำให้งานของคุณง่ายขึ้นมาก

  • เปิดใช้งานการแก้ไขและอ่านแบบแท็บใน Word, Excel, PowerPoint, ผู้จัดพิมพ์, Access, Visio และโครงการ
  • เปิดและสร้างเอกสารหลายรายการในแท็บใหม่ของหน้าต่างเดียวกันแทนที่จะเป็นในหน้าต่างใหม่
  • เพิ่มประสิทธิภาพการทำงานของคุณ 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