#NUM! error

leopardhawk

Well-known Member
Joined
May 31, 2007
Messages
611
Office Version
  1. 2016
Platform
  1. Windows
Regarding this formula:

If there are dates in E8 (September 23, 1953) and H8 (April 1, 2017) the formula is returning "Started pension at 63 years and 6 months of age.". This is good.

If both cells are blank, the formula is returning "Started pension at 0 years and 0 months of age." which is also good.

However, for practical purposes, there will be situations where H8 will be blank and if it is, then I am receiving a #NUM ! error.

What I am trying to accomplish is that the formula should also return "Started pension at 0 years and 0 months of age." if H8 is blank. Is this possible?

Code:
="Started pension at "&DATEDIF('personal information'!E8,'personal information'!H8,"y")& " years " &DATEDIF('personal information'!E8,'personal information'!H8,"ym")&" months of age."
Thanks!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
You'll need to nest an IF/IFERROR statement, DATEDIF can't compare a legit date to a blank cell (when entering legit date as parameter 1), as the compared date (cell H8) must be equal or greater than the initial date (cell E8).

So you could say if E8 is greater than H8 then return "Started pension at 0 years 0 months of age." Otherwise have it run the formula you posted.

Like so:

Code:
IF('personal information'!E8>'personal information'!H8,"Started pension at 0 years 0 months of age.","Started pension at "&DATEDIF('personal information'!E8,'personal information'!H8,"y")& " years " &DATEDIF('personal information'!E8,'personal information'!H8,"ym")&" months of age.")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,242
Members
452,623
Latest member
russelllowellpercy

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