Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11
Default YEAR MONTH DAYS COUNTER

Hi,
I have a sheet in which I want to count the year then month and then
days for employee. i.e

Name Date of joining Date of leaving Absent Total
JOHN 23-08-2001 11-11-2008 15 Years-Months-Days


I want that Function or formula count first Rounded Year from
23-08-2001 23-08-2008 then count Month and then days. and then minus
Absent days and final result. Pls help me.

Best Regards.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 39
Default YEAR MONTH DAYS COUNTER

ad2ad79,
Use DateDif Function:
A1: Start Date (format column "dd-mm-yyyy")
B1: End Date (format column "dd-mm-yyyy")
C1: Absent Days (format column "General")
D1: Difference (format column "General")

In Cell D2, place the following formula:

=IF($A2="","",DATEDIF(A2,B2,"y")&" years "&DATEDIF(A2,B2,"ym")&" months
"&DATEDIF(A2,B2,"md")-C2
&" days")"

Then drag down through column "D" the above formula, as needed.

--
Add MS to your News Reader: news://msnews.microsoft.com
Rich/rerat
(RRR News) <message rule
<<Previous Text Snipped to Save Bandwidth When Appropriate


"ad2ad79" wrote in message
...
Hi,
I have a sheet in which I want to count the year then month and then
days for employee. i.e

Name Date of joining Date of leaving Absent Total
JOHN 23-08-2001 11-11-2008 15 Years-Months-Days


I want that Function or formula count first Rounded Year from
23-08-2001 23-08-2008 then count Month and then days. and then minus
Absent days and final result. Pls help me.

Best Regards.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default YEAR MONTH DAYS COUNTER


Rich, that might work for this example but in some circumstances you'll
get the wrong results, e.g. negative number for days, you need to
incorporate -D2 into DATEDIF, see my response 'here'
(http://tinyurl.com/m3huwa)


--
barry houdini
------------------------------------------------------------------------
barry houdini's Profile: http://www.thecodecage.com/forumz/member.php?userid=72
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=106332

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 39
Default YEAR MONTH DAYS COUNTER

Barry,
Thanks for the correction, I see now where I messed up.

--
Add MS to your News Reader: news://msnews.microsoft.com
Rich/rerat
(RRR News) <message rule
<<Previous Text Snipped to Save Bandwidth When Appropriate


"barry houdini" wrote in message
...

Rich, that might work for this example but in some circumstances you'll
get the wrong results, e.g. negative number for days, you need to
incorporate -D2 into DATEDIF, see my response 'here'
(http://tinyurl.com/m3huwa)


--
barry houdini
------------------------------------------------------------------------
barry houdini's Profile:
http://www.thecodecage.com/forumz/member.php?userid=72
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=106332


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,203
Default YEAR MONTH DAYS COUNTER

As posted in the other copy of your question:

This formula assumes working with values on row 2, where
B2 = joined date
C2 = left date
D3 = days absent

=DATEDIF(B2-D2,C2,"y") & " Yrs, " & DATEDIF(B2-D2,C2,"ym") & " months " &
DATEDIF(B2-D2,C2,"md") & " days"

Adapted from Chip Pearson's "calculating age" solution at:
http://www.cpearson.com/excel/datedif.aspx


"ad2ad79" wrote:

Hi,
I have a sheet in which I want to count the year then month and then
days for employee. i.e

Name Date of joining Date of leaving Absent Total
JOHN 23-08-2001 11-11-2008 15 Years-Months-Days


I want that Function or formula count first Rounded Year from
23-08-2001 23-08-2008 then count Month and then days. and then minus
Absent days and final result. Pls help me.

Best Regards.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default YEAR MONTH DAYS COUNTER


But shouldn't the absent days be subtracted from the total duration? By
subtracting from the start date you are effectively adding those days.
I'd suggest that you either need to add D2 to B2 or subtract D2 from C2,
either would have the same affect.

I posted this solution on another version of this thread (as alluded to
above)

=DATEDIF(B2,C2-D2,"y")&" years "&DATEDIF(B2,C2-D2,"ym")&" months
"&DATEDIF(B2,C2-D2,"md")&" days"


--
barry houdini
------------------------------------------------------------------------
barry houdini's Profile: http://www.thecodecage.com/forumz/member.php?userid=72
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=106332

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,203
Default YEAR MONTH DAYS COUNTER

You're probably right about "when" to subtract the absent days. I didn't
think about it properly. Good catch, thanks.

"barry houdini" wrote:


But shouldn't the absent days be subtracted from the total duration? By
subtracting from the start date you are effectively adding those days.
I'd suggest that you either need to add D2 to B2 or subtract D2 from C2,
either would have the same affect.

I posted this solution on another version of this thread (as alluded to
above)

=DATEDIF(B2,C2-D2,"y")&" years "&DATEDIF(B2,C2-D2,"ym")&" months
"&DATEDIF(B2,C2-D2,"md")&" days"


--
barry houdini
------------------------------------------------------------------------
barry houdini's Profile: http://www.thecodecage.com/forumz/member.php?userid=72
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=106332


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11
Default YEAR MONTH DAYS COUNTER

On Jun 13, 6:50*pm, "Rich/rerat" wrote:
Barry,
Thanks for the correction, I see now where I messed up.

--
Add MS to your News Reader: news://msnews.microsoft.com
Rich/rerat
(RRR News) * *<message rule
<<Previous Text Snipped to Save Bandwidth When Appropriate

"barry houdini" wrote in message

...

Rich, that might work for this example but in some circumstances you'll
get the wrong results, e.g. negative number for days, you need to
incorporate -D2 into DATEDIF, see my response 'here'
(http://tinyurl.com/m3huwa)

--
barry houdini
------------------------------------------------------------------------
barry houdini's Profile:http://www.thecodecage.com/forumz/member.php?userid=72
View this thread:http://www.thecodecage.com/forumz/sh...d.php?t=106332


Thanks Barry ... That's what i needed thanks a lot.... so kind of u...
Thanks once again..
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
YEAR MONTH DAYS COUNTER Gerry[_3_] Excel Discussion (Misc queries) 4 June 13th 09 06:53 PM
YEAR MONTH DAYS COUNTER ad2ad79 Excel Worksheet Functions 2 June 13th 09 04:28 PM
YEAR MONTH DAYS COUNTER ad2ad79 Excel Discussion (Misc queries) 4 June 13th 09 02:27 PM
Calc Prorated Cost based on Specific Days in a Given Month & Year Range (Revisited..) [email protected] Excel Discussion (Misc queries) 8 October 2nd 07 12:15 AM
To detect month or days or year in if formula ShamsulZ Excel Discussion (Misc queries) 1 November 6th 06 07:47 AM


All times are GMT +1. The time now is 09:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"