Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
formula to calculate age at a given date in years and months? | Excel Discussion (Misc queries) | |||
HOW DO I CALCULATE THE YEARS MONTHS AND DAYS BETWEEN SEVERAL DATE | Excel Discussion (Misc queries) | |||
HOW DO YOU CALCULATE AGE BY DATE OF BIRTH I NEED YEARS AND MONTHS | Excel Discussion (Misc queries) | |||
Excel Adding years or months to a date | Excel Discussion (Misc queries) | |||
How do I Add or subtract months or years from a date in Excel | Excel Programming |