# Data Formula



## rentonhighlands (Yesterday at 3:13 PM)

Current expiration date is 8/31/2024.  From today() how do I write the formula that will give me the result in the format of year, months, days.


----------



## Sufiyan97 (Yesterday at 3:18 PM)

Edit:
---IGNORE---
Not got it right

Is that what you want?

Book10ABCD128/31/20241/14/20231 Year, 19 Months, 595 Days3Sheet1Cell FormulasRangeFormulaB2B2=TODAY()C2C2=CONCATENATE(DATEDIF(B2,A2,"y")," Year, ",DATEDIF(B2,A2,"m")," Months, ",DATEDIF(B2,A2,"d")," Days")


----------



## Z51 (Yesterday at 3:19 PM)

If your expiration date is in cell A1, then:

```
=DATEDIF(TODAY(),A1,"y")&" years, "&DATEDIF(TODAY(),A1,"ym")&" months, "&DATEDIF(TODAY(),A1,"md")&" days"
```


----------



## rentonhighlands (Yesterday at 3:23 PM)

@Z51 Thank you that is it.


----------



## rentonhighlands (Yesterday at 3:27 PM)

Why do I get a #NUM error on 1 cell?  The other cells work.


----------



## rentonhighlands (Yesterday at 3:28 PM)

Oh it must be because the date is already expired.


----------



## rentonhighlands (Yesterday at 3:33 PM)

If there are zero days left then how to I make the cell state Expired?


----------



## Z51 (Yesterday at 3:40 PM)

```
=IF(TODAY()<=A1,DATEDIF(TODAY(),A1,"y")&" years, "&DATEDIF(TODAY(),A1,"ym")&" months, "&DATEDIF(TODAY(),A1,"md")&" days","Expired")
```


----------



## rentonhighlands (Yesterday at 4:40 PM)

@Z51 if cell is blank I need the formula to keep the cell blank
=IF(TODAY()<=A1,DATEDIF(TODAY(),A1,"y")&" years, "&DATEDIF(TODAY(),A1,"ym")&" months, "&DATEDIF(TODAY(),A1,"md")&" days","Expired")


----------



## Z51 (Yesterday at 5:19 PM)

```
=IF(A1="","",IF(TODAY()<=A1,DATEDIF(TODAY(),A1,"y")&" years, "&DATEDIF(TODAY(),A1,"ym")&" months, "&DATEDIF(TODAY(),A1,"md")&" days","Expired"))
```


----------



## rentonhighlands (Yesterday at 3:13 PM)

Current expiration date is 8/31/2024.  From today() how do I write the formula that will give me the result in the format of year, months, days.


----------



## rentonhighlands (Yesterday at 5:24 PM)

@Z51 
I tried this =IF(A1="","",IF(TODAY()<=A1,DATEDIF(TODAY(),A1,"y")&" years, "&DATEDIF(TODAY(),A1,"ym")&" months, "&DATEDIF(TODAY(),A1,"md")&" days","Expired"))
the result still give me expired


----------



## Z51 (Yesterday at 5:35 PM)

If A1 is completely empty (""), the result will be empty ("").  If A1 is not empty, it will perform the date checks.  If today <= A1, a result will be shown in ymd's.  If today > A1, it will show "Expired".  It works exactly as expected in my worksheet.


----------



## rentonhighlands (Yesterday at 5:51 PM)

Yep I copied and pasted from your response I got it working thank you


----------

