How to get the value 30 as per the example?

  • Thread starter Thread starter Trish
  • Start date Start date
T

Trish

Hi All,

I have two cells having dates 30/6/07 & 31/5/07. I need the difference (no.
of days) between these two days in a cell. Always I am getting the cell
value in date format. How to get the value 30 as per the above example?

Thanks for any replies.

Trish
 
Trish said:
Hi All,

I have two cells having dates 30/6/07 & 31/5/07. I need the difference
(no.
of days) between these two days in a cell. Always I am getting the cell
value in date format. How to get the value 30 as per the above example?

Thanks for any replies.

Trish

Presumably you're talking about Excel, even though you
never say so. If so then you should post your question in
an Excel newsgroup.
 
Assuming you are running MS Excel you would have been better off posting to one
of the Excel groups.

But since I'm here I'll give you a formula.

With earliest date in A2 and later date in A3 enter this in a cell.

=DATEDIF(A2,A3,"d") returns 30 with your example data.

To expand if you want years, months, days for longer periods.

=DATEDIF(A2,A3,"y") & "years," & DATEDIF(A2,A3,"ym") & "months,"&
DATEDIF(A2,A3,"md") & "days,"

DATEDIF function is undocumented in all versions of Excel except XL2000


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top