Archive of Mr Excel Message Board


Back to Forms in Excel VBA archive index
Back to archive home

"If" statement problem

Posted by Robert Dorr on May 06, 2001 6:53 AM
I am using an if statement for a solution (???) to a simple problem but it is not working the way I expect and my tiny brain cannot figure out the reason (therein lies the answer perhaps!)

The statement is as follows:
=if($D$19="Y",if(A19="*",(C19*.909),C19))

The above works okay when D19= "Y" (true) but when D19 is not equal to "Y" (ie false)then the formulae returns "FALSE" in the cell it is located whereas I expect it to return the value in C19.
I thought the formula would work like this if D19 did equal "Y"
"If D19 ="Y" True then move on to the next bit and if A19="*" True then perform the calculation (C19*.909). Whilst this does work I thought the other two possible "False" cases worked like this:
IF D19 does not equal "Y", (False) then go the "False" "Else" result which is C19.
or
If D19 does equal "Y" (True), then go to the next bit and if A19 does not equal "*" (False) then go to the "Else" answer which is C19.

Please tell me where I am going off the rails on this please. I must be makink a major mistake in my logic process.


Check out our Excel Resources

Re: "If" statement problem

Posted by Aladin Akyurek on May 06, 2001 7:34 AM
Robert,

Change it to:

=IF($D$19="Y",IF(A19="*",C19*0.909,C19),C19)

or better:

=IF(AND($D$19="Y",A19="*",C19*0.909,C19)

Aladin



This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.