Solved

# Excel If or statment

Posted on 2011-05-09
Medium Priority
201 Views
Trying to combined two if statements together.

=IF(B2<DATEVALUE("1/1/2011"),C2-DATEVALUE("1/1/2011"),C2-B2)

=IF(ISBLANK(C2)=TRUE,B2-DATEVALUE("1/1/2011"),C2-B2)

Tried this statement but not working correctly.

=IF(OR(ISBLANK(C2)=TRUE,B2<DATEVALUE("1/1/2011"),DATEVALUE("1/1/2011")-C2,C2-DATEVALUE("1/1/2011")),C2-B2)
Date-Test.xlsx
0
Question by:jbakerstull
• 5
• 3

LVL 81

Expert Comment

ID: 35723340
=IF(OR(ISBLANK(C2)=TRUE,B2<DATEVALUE("1/1/2011")),DATEVALUE("1/1/2011")-C2,C2-DATEVALUE("1/1/2011"),C2-B2)

Kevin
0

LVL 81

Accepted Solution

zorvek (Kevin Jones) earned 1000 total points
ID: 35723394

=IF(ISBLANK(C2),B2-DATEVALUE("1/1/2011"),IF(B2<DATEVALUE("1/1/2011"),C2-DATEVALUE("1/1/2011"),C2-B2))

Kevin
0

Author Comment

ID: 35723395
received error: too many arguments for this function.
0

Author Closing Comment

ID: 35723407
thank you.
0

LVL 81

Expert Comment

ID: 35723429
Wait, before you leave, what are you trying to calculate?

Kevin
0

LVL 81

Expert Comment

ID: 35723444
If B and C are entered you want the difference in days between the two dates.

What do you want if C is not entered? The difference in dates from 1/1/2011 whether B is before or after that date?

Kevin
0

LVL 81

Expert Comment

ID: 35723518
This formula produces the same result and might be easier to understand:

=IF(C2="",B2-DATEVALUE("1/1/2011"),C2-MAX(B2,DATEVALUE("1/1/2011")))

Kevin
0

Author Comment

ID: 35724005
Sorry.. If C is missing.. then I applied a date value.. that's why I was using isblank = true then assigned a datevalue
0

## Featured Post

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
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.
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…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
###### Suggested Courses
Course of the Month17 days, 13 hours left to enroll