Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Date since hired displayed in years.months

Hi,
I have a spreadsheet that calculated the time a person has been working for
the company. However in some cases I have not been given the date hired so
my results are incorrect.

I am using the formula

=DATEDIF(D27,TODAY(),"Y") & "." & DATEDIF(D27,TODAY(),"YM")

Where D27 refers to the date in the previous column. If the date column is
empty the result is something like 106.4 meaning 106 years and 4 months.

The formula works great in all other circumstances giving results such as
7.3 for seven years three months.

Is there a way to check to see if the date field is empty first, then make
the result field remain empty, and then still work on the other fields?

Can anyone modify the above code to check first for an empty field?

Thanks

JL


  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Date since hired displayed in years.months

wrap your formula with the IF function.
=IF(D27="","",DATEDIF(.......))


"JL" wrote:

Hi,
I have a spreadsheet that calculated the time a person has been working for
the company. However in some cases I have not been given the date hired so
my results are incorrect.

I am using the formula

=DATEDIF(D27,TODAY(),"Y") & "." & DATEDIF(D27,TODAY(),"YM")

Where D27 refers to the date in the previous column. If the date column is
empty the result is something like 106.4 meaning 106 years and 4 months.

The formula works great in all other circumstances giving results such as
7.3 for seven years three months.

Is there a way to check to see if the date field is empty first, then make
the result field remain empty, and then still work on the other fields?

Can anyone modify the above code to check first for an empty field?

Thanks

JL



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
formula to calculate age at a given date in years and months? sjric2 Excel Discussion (Misc queries) 3 February 18th 07 08:51 PM
HOW DO I CALCULATE THE YEARS MONTHS AND DAYS BETWEEN SEVERAL DATE Susan Excel Discussion (Misc queries) 1 June 29th 06 02:27 PM
HOW DO YOU CALCULATE AGE BY DATE OF BIRTH I NEED YEARS AND MONTHS dallyup2 Excel Discussion (Misc queries) 2 February 28th 06 08:20 PM
Excel Adding years or months to a date Joan Excel Discussion (Misc queries) 2 April 25th 05 08:09 PM
How do I Add or subtract months or years from a date in Excel Dug Rowland Excel Programming 2 October 22nd 04 02:09 AM


All times are GMT +1. The time now is 03:58 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"