# Calculating y,m,d not including blanks

#### Taiter

##### New Member
Greetings,

I am trying to calculate the amount of time from a date (m/d/yyyy) to show # years, # month, # day but ignore cell if blank. The formula I am using is IF([@[BEGIN DATE-MIN ]]<>"",DATEDIF([@[BEGIN DATE-MIN ]],TODAY(),"y"), DATEDIF([@[BEGIN DATE-MIN ]],TODAY(),"y")&" year, ")&IF(DATEDIF([@[BEGIN DATE-MIN ]],TODAY(),"ym"), DATEDIF([@[BEGIN DATE-MIN ]],TODAY(),"ym")&" month, ","")&IF(DATEDIF([@[BEGIN DATE-MIN ]],TODAY(),"md"), DATEDIF([@[BEGIN DATE-MIN ]],TODAY(),"md")&" day","")

It works fine when IF([@[BEGIN DATE-MIN ]]<>"", is not used but it drops the year with it. What am I missing?

Appreciate any help.

### Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

#### RoryA

##### MrExcel MVP, Moderator
It looks like you should be using:

=IF([@[BEGIN DATE-MIN ]]<>"",IF(DATEDIF([@[BEGIN DATE-MIN ]],TODAY(),"y"), DATEDIF([@[BEGIN DATE-MIN ]],TODAY(),"y")&" year,"")&IF(DATEDIF([@[BEGIN DATE-MIN ]],TODAY(),"ym"), DATEDIF([@[BEGIN DATE-MIN ]],TODAY(),"ym")&" month, ","")&IF(DATEDIF([@[BEGIN DATE-MIN ]],TODAY(),"md"), DATEDIF([@[BEGIN DATE-MIN ]],TODAY(),"md")&" day",""),"")

#### Taiter

##### New Member
Thank you for the reply. Now it causes an error and highlights the "ym".

#### RoryA

##### MrExcel MVP, Moderator
Which "ym" (there are two) and what is the error message?

Replies
9
Views
78
Replies
14
Views
214
Replies
7
Views
141
Replies
1
Views
151
Replies
6
Views
312

1,127,787
Messages
5,626,876
Members
416,208
Latest member
tan21

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back