ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   If Statement returns true when false? (https://www.excelbanter.com/excel-discussion-misc-queries/109296-if-statement-returns-true-when-false.html)

Eric

If Statement returns true when false?
 
Here is the formula I am using
G21=5188
G22=10
G24=.12
G28=5188
G29-1556
=IF(G28<G22=SUM(G28:G29),G24*(G22-G21),IF(G22<G21,0,G29*G24))

Why does the statement start false and turn true? If it starts false
shouldn't it stay false no matter what the rest of the logical test says? So
what kind of logical test do i need to write so that if either part is false
then the statement is false?


bpeltzer

If Statement returns true when false?
 
If your intent is to require that G28<G22 and G22=SUM(G28:G29), put those
two tests inside an AND function:
=IF(AND(G28<G22,G22=SUM(G28:G29)),G24*(G22-G21),IF(G22<G21,0,G29*G24))

"Eric" wrote:

Here is the formula I am using
G21=5188
G22=10
G24=.12
G28=5188
G29-1556
=IF(G28<G22=SUM(G28:G29),G24*(G22-G21),IF(G22<G21,0,G29*G24))

Why does the statement start false and turn true? If it starts false
shouldn't it stay false no matter what the rest of the logical test says? So
what kind of logical test do i need to write so that if either part is false
then the statement is false?


Otto Moehrbach

If Statement returns true when false?
 
I don't think that formula is written to do what you want it to do. State
in words what you want that formula to do. In detail. HTH Otto
"Eric" wrote in message
...
Here is the formula I am using
G21=5188
G22=10
G24=.12
G28=5188
G29-1556
=IF(G28<G22=SUM(G28:G29),G24*(G22-G21),IF(G22<G21,0,G29*G24))

Why does the statement start false and turn true? If it starts false
shouldn't it stay false no matter what the rest of the logical test says?
So
what kind of logical test do i need to write so that if either part is
false
then the statement is false?




Dave F

If Statement returns true when false?
 
I think you need an AND statement:

=IF(AND(G28<G22,G22=SUM(G28:G29),G24*(G22-G21),IF(G22<G21,0,G29*G24))

"IF G28 is less than G22 AND G22 is greater than the SUM of G28:G29, THEN
multiply G24 by (G22 - G21), ELSE IF G22 is less than G21, THEN 0, ELSE G29
times G24." Is that the logic you're looking for? If it is, then the
formula above is what you want.

Dave
--
Brevity is the soul of wit.


"Eric" wrote:

Here is the formula I am using
G21=5188
G22=10
G24=.12
G28=5188
G29-1556
=IF(G28<G22=SUM(G28:G29),G24*(G22-G21),IF(G22<G21,0,G29*G24))

Why does the statement start false and turn true? If it starts false
shouldn't it stay false no matter what the rest of the logical test says? So
what kind of logical test do i need to write so that if either part is false
then the statement is false?



All times are GMT +1. The time now is 01:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com