Posted to microsoft.public.excel.programming
|
|
Complex IF OR AND Statement
I have the following semi-complex if statement:
IF(OR(7/31/2009X2,7/31/2010<Y2),IF(7/31/2009-X2<=30,((7/31/2009-X2)/31)*G2,IF(7/31/2009-Y2<=30,((7/31/2009-Y2)/31*G2),G2,0).
Basically a project has a start date and end date.
If the project encompasses the entire month of July 2009, the project is expensed the entire amount for that whole month. If the project starts or ends w/in July 2009, the number of days divided by 31 times the monthly cost is allocated for that project for that month. Otherwise, if the project does not start or end in July 2009, there is zero costs of the project. Is there anyone who can assist me in writing this function correctly?
Thank you.
On Tuesday, October 09, 2007 11:45 AM Karen5 wrote:
Hi,
I have a cell that is set to watch two other cells and flag a warning if
they do not match. I have it so the flag will come up if they do not match
but it doesn't clear when they do match. Can anyone help?
=IF(OR(OR(AND($B$26="Yes",LEFT($E$1,6)<"Anchor"), AND($B$26="Yes",LEFT($E$1,5)<"Major")),AND($B$26= "No",LEFT($E$1,6)="Anchor"),AND($B$26="No",(LEFT($ E$1,5)="Major"))),"Major Indicators do not match","")
--
Thanks for your help.
Karen53
On Tuesday, October 09, 2007 12:07 PM Joe wrote:
You the evqluate formula too to help isolate which part of the and is not
working. All items need to be true
Click cell with formula
Tools Menu - Formula Auditing - Evaluate Formula
"Karen53" wrote:
On Tuesday, October 09, 2007 12:24 PM PaulCordt wrote:
Nested AND and OR statement with < can be problematic even when evaluating
the formula. I ususally try to avoid < with the nested statements.
Try something like this, it is a little longer but easier to trace.
=IF($B$26="Yes",IF(OR(LEFT($E$1,6)="Anchor",LEFT($ E$1,5)="Major"),"","Major
Indicators do not
match"),IF($B$26="No",IF(OR(LEFT($E$1,6)="Anchor", LEFT($E$1,5)="Major"),"Major Indicators do not match","")))
--
Paul Cordts
"Joel" wrote:
On Tuesday, October 09, 2007 12:35 PM Joe wrote:
Paul: I think the AND OR solution is better than nested IF statements. <
with AND and OR are perfecrtly acceptable and the much better approach. The
AND OR approach makes it easier to draw truth tables and use DeMorgan's Law.
"Paul Cordts" wrote:
On Tuesday, October 09, 2007 1:50 PM Karen5 wrote:
Thank you both for your help.
--
Thanks for your help.
Karen53
"Joel" wrote:
On Friday, October 29, 2010 8:35 PM Jumma Khan wrote:
I have the following semi-complex if statement:
IF(OR(7/31/2009X2,7/31/2010<Y2),IF(7/31/2009-X2<=30,((7/31/2009-X2)/31)*G2,IF(7/31/2009-Y2<=30,((7/31/2009-Y2)/31*G2),G2,0).
Basically a project has a start date and end date.
If the project encompasses the entire month of July 2009, the project is expensed the entire amount for that whole month. If the project starts or ends w/in July 2009, the number of days divided by 31 times the monthly cost is allocated for that project for that month. Otherwise, if the project does not start or end in July 2009, there is zero costs of the project. Is there anyone who can assist me in writing this function correctly?
Thank you.
Submitted via EggHeadCafe - Software Developer Portal of Choice
Styling the WPF ScrollViewer
http://www.eggheadcafe.com/tutorials...ollviewer.aspx
|