Archive of Mr Excel Message Board

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

"If statement"
Posted by Jim on May 14, 2001 5:06 PM
Can someone please show me how to write this fomula?
=If(E22"isn't equal to E14" then -G22 "Next" G6*B14
*A14

| Check out our Excel Resources
|
 |
 |
Re: "If statement"
Posted by Mark W. on May 14, 2001 5:09 PM
I trust you mean "Else" instead of "Next", and
that your really want to negate G22...
=IF(E22 <> E14,-G22,G6*B14*A14)

Re: "If statement"
Posted by Jim on May 14, 2001 5:39 PM
G6"3000"*B14"1",G14 ="3000", E14"6", E22"4" since
E14 does not equal E22 i need to subtract G22"100"
From G14"3000" ans. should be 2900 but it returns
-100 ? If E14 = E22 No subtraction? i hope this
makes some kind of sence.

Makes perfect sense after a couple beers
Posted by Kevin James on May 14, 2001 8:30 PM
=IF(E14<>E22,G14-G22,"")

Re: "If statement"
Posted by Mark W. on May 14, 2001 8:34 PM
> i hope this makes some kind of sence.
I'm afraid not. It seems that you want this
formula to affect the cell (G14) in which it
resides....
=IF(E22 <> E14,G14-G22,G6*B14)
...this is known as a circular reference, and
Excel does not allow them.

Re: Makes perfect sense after a couple beers
Posted by Jim on May 14, 2001 8:56 PM
True, that formula does return circular but
i'm getting True or False, Example:
=If(E22<>E14,-G22,*B14*A14)=(If(E22=E14,G6*B14
*A14)) if i could get it to return an integer
i could move on and open another can of worms.
Jim

Re: Makes perfect sense after a couple beers
Posted by Kevin James on May 15, 2001 10:56 AM
Jim,
I didn't get a circular reference when I used it. All I can think is that you have entered the formula in one of the cells that is referenced in the formula. The formula I provided works and returns 290 but I entered it into a cell other than the four you mentioned in your original posting.
Kevin

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.