Calculating y,m,d not including blanks

Taiter

New Member
Joined
Jun 27, 2012
Messages
12
Office Version
  1. 365
Platform
  1. Windows
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

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
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",""),"")
 
Upvote 0
Thank you for the reply. Now it causes an error and highlights the "ym".
 
Upvote 0
Which "ym" (there are two) and what is the error message?
 
Upvote 0

Forum statistics

Threads
1,224,745
Messages
6,180,699
Members
452,994
Latest member
Janick

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top