year of service

sachin483

Board Regular
Joined
Mar 31, 2015
Messages
163
Office Version
  1. 2019
Platform
  1. Windows
i am using year of service formula as below but if the date is blank it is catching 119 instead of zero i want to do zero service

=DATEDIF(A2,TODAY(),"y")&" Years "&DATEDIF(A2,TODAY(),"ym")&" Months "&DATEDIF(A2,TODAY(),"md")&" Days"

[TABLE="width: 431"]
<colgroup><col><col span="2"></colgroup><tbody>[TR]
[TD]21-Jun-97[/TD]
[TD][/TD]
[TD]21 Years 7 Months 24 Days[/TD]
[/TR]
[TR]
[TD]26-Feb-97[/TD]
[TD][/TD]
[TD]21 Years 11 Months 19 Days[/TD]
[/TR]
[TR]
[TD]09-Jul-01[/TD]
[TD][/TD]
[TD]17 Years 7 Months 5 Days[/TD]
[/TR]
[TR]
[TD]12-Mar-05[/TD]
[TD][/TD]
[TD]13 Years 11 Months 2 Days[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]119 Years 1 Months 14 Days[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
i am using year of service formula as below but if the date is blank it is catching 119 instead of zero i want to do zero service

=DATEDIF(A2,TODAY(),"y")&" Years "&DATEDIF(A2,TODAY(),"ym")&" Months "&DATEDIF(A2,TODAY(),"md")&" Days"

[TABLE="width: 431"]
<tbody>[TR]
[TD]21-Jun-97[/TD]
[TD][/TD]
[TD]21 Years 7 Months 24 Days[/TD]
[/TR]
[TR]
[TD]26-Feb-97[/TD]
[TD][/TD]
[TD]21 Years 11 Months 19 Days[/TD]
[/TR]
[TR]
[TD]09-Jul-01[/TD]
[TD][/TD]
[TD]17 Years 7 Months 5 Days[/TD]
[/TR]
[TR]
[TD]12-Mar-05[/TD]
[TD][/TD]
[TD]13 Years 11 Months 2 Days[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]119 Years 1 Months 14 Days[/TD]
[/TR]
</tbody>[/TABLE]

=IF(A2<>"",DATEDIF(A2,TODAY(),"y")&" Years "&DATEDIF(A2,TODAY(),"ym")&" Months "&DATEDIF(A2,TODAY(),"md")&" Days",DATEDIF(TODAY(),TODAY(),"y")&" Years "&DATEDIF(TODAY(),TODAY(),"ym")&" Months "&DATEDIF(TODAY(),TODAY(),"md")&" Days"
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,187
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top