Monday, August 12, 2013

yogi_Compute Difference In Dates In A Column From Today In Years Months And Days Only If Non-Zero

                                          Google Spreadsheet   Post  #1329
Yogi Anand, D.Eng, P.E.      ANAND Enterprises LLC -- Rochester Hills MI     www.energyefficientbuild.com.   Aug, 12 2013
user macman104 (http://productforums.google.com/forum/?zx=7udaj0vehrz6#!topic/docs/b4oNZmPTJRg)
Calculate Years, Month, Days based on Today's date (help modifying an existing solution)
There was this question here:


Which provided basically the solution I am looking for, but I do not quite know to how to merge it to what I need.

I have a column with a date in it.  I would like the column next to it (if the adjacent column does have a date present, so I need to check for that) to print the difference from TODAY() as:

xx years, xx months, xx days.  
But if one of those values is 0, then to skip that one.  So if the date was 2 years and 10 months ago exactly, it would print:
"2 years, 10 months" and leave out the days printout

Likewise, if it was 10 months and 2 days, it would skip the years part of the printout.

Their solution had separate columns (whereas I would like it all in one with some text printed), and I would like to add the detection if one of them is 0 to skip that specific value.

Thank you!
---
Hello,

I unfortunately cannot share the spreadsheet, it contains confidential information.

But it is very straight-forward concept.

Column 1:  Contains cells with a date in them (MM/DD/YYYY), some cells will be blank
Column 2:  Will print the difference between today's date and the date in the same row of column 1 ONLY if the adjacent cell in column 1 has a value in it

I referenced the earlier post which contains what I think is the primary equation I need, but it needs modification.

Here are some examples (note the plurals):
Column 1 Value:  05/19/2013
Column 2 Expected Result:  2 months, 24 days

Column 1 Value:  08/12/2012
Column 2 Expected Result:  1 year

Column 1 Value:  07/12/2012
Column 2 Expected Result:  1 year, 1 month

Column 1 Value:  08/12/2010
Column 2 Expected Result:  2 years
----------------------------------------------------------------------------------------------------------------------------------------------------------