Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# Modifying DATEDIF formula if Column A is blank

Posted on 2014-03-25
Medium Priority
3,620 Views
I am using the following DATEDIF formula to get the number of days in Column D:

=IFERROR(DATEDIF(B2,C2,"D"),"")

But sometimes there are blank cells in Column A and so it's causing errors in my calculations for those rows (1000's of days).

I'd like to be able to modify the above formula to include:

If A2 is blank, then D2 to be blank as well.

Thanks!
Andrea
0
Question by:Andreamary
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2
• 2

LVL 39

Expert Comment

ID: 39953857
Try

=IF(A2="","",ERROR(DATEDIF(B2,C2,"D"),""))

Thomas
0

Author Comment

ID: 39953875
Hi Thomas,

I'm getting an error message that highlights the word "ERROR" in the formula and says "that function not valid"...

Thanks,
Andrea
0

LVL 39

Accepted Solution

nutsch earned 2000 total points
ID: 39953878

=IF(A2="","",IFERROR(DATEDIF(B2,C2,"D"),""))
1

LVL 8

Expert Comment

ID: 39953881
Change to IFERROR

Thanks
0

Author Closing Comment

ID: 39953894
That did the trick...thanks very much!
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
###### Suggested Courses
Course of the Month9 days, 9 hours left to enroll