INVALID DATA TYPE return for a date formula

I have a formula that works to add 5 years to a date if the source cell has a date in it. If it doesn't, it returns #INVALID DATA TYPE.
How do I adjust the formula to stay blank or return nothing?
=DATE(YEAR([AC UPS Completed]@row) + 5, MONTH([AC UPS Completed]@row, DAY([AC UPS Completed]@row)))
Answers
-
You would use an IFERROR function.
=IFERROR(original_formula, "")
-
@Paul Newcome does this look correct?
=DATE(YEAR([AC UPS Completed]@row) + 5, MONTH([AC UPS Completed]@row, DAY([AC UPS Completed]@row) = 0, ""))
I tried it and am still getting the same error - and I wanted to check with you about the formula before I start jumping to conclusions.
-
No. You are missing the IFERROR entirely, and you forgot to close out your MONTH function.
-
Sorry @Paul Newcome. Does this look better, or am I still missing something?
=IERROR(DATE(YEAR([AC UPS Completed]@row) +5, MONTH([AC UPS Completed]@row, DAY([AC UPS Completed]@row) = 0, "")))
-
You still need to close out the MONTH function, you don't need the =0 portion, and you have too many closing parenthesis on the end.
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 67.2K Get Help
- 452 Global Discussions
- 155 Industry Talk
- 505 Announcements
- 5.4K Ideas & Feature Requests
- 85 Brandfolder
- 156 Just for fun
- 81 Community Job Board
- 514 Show & Tell
- 34 Member Spotlight
- 2 SmartStories
- 308 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!