?
Solved

Excel If or statment

Posted on 2011-05-09
8
Medium Priority
?
201 Views
Last Modified: 2012-05-11
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
Comment
Question by:jbakerstull
  • 5
  • 3
8 Comments
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
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

by:
zorvek (Kevin Jones) earned 1000 total points
ID: 35723394
I goofed. How about:

=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

by:jbakerstull
ID: 35723395
received error: too many arguments for this function.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Closing Comment

by:jbakerstull
ID: 35723407
thank you.
0
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 35723429
Wait, before you leave, what are you trying to calculate?

Kevin
0
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
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

by:zorvek (Kevin Jones)
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

by:jbakerstull
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question