ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   why doesn't my conditional formula work? (https://www.excelbanter.com/excel-discussion-misc-queries/16458-why-doesnt-my-conditional-formula-work.html)

jake

why doesn't my conditional formula work?
 
can anyone tell me why the following doesn't work?

=IF(B3="Buy", [G3*(F3-E3)], [G3*(E3-F3)])

or possibly suggest another way of achieving the same result, so that a
'Buy' transaction will produce one calculation, and a 'Sell' (or non-'Buy)
transaction will produce another?

cheers

tjtjjtjt

You want G3 mulitplied by the result of F3-E3 for true?
and
You want G3 mulitplied by the result of E3-F3 for false?

If so, you should not be using square brackets--replace them with parentheses.
Also, you shouldn't have any spaces in the formula.
=IF(B3="Buy",(G3*(F3-E3)),(G3*(E3-F3)))

tj

"jake" wrote:

can anyone tell me why the following doesn't work?

=IF(B3="Buy", [G3*(F3-E3)], [G3*(E3-F3)])

or possibly suggest another way of achieving the same result, so that a
'Buy' transaction will produce one calculation, and a 'Sell' (or non-'Buy)
transaction will produce another?

cheers


Bob Phillips

=IF(B3="Buy", G3*(F3-E3), G3*(E3-F3))

--

HTH

RP
(remove nothere from the email address if mailing direct)


"jake" wrote in message
...
can anyone tell me why the following doesn't work?

=IF(B3="Buy", [G3*(F3-E3)], [G3*(E3-F3)])

or possibly suggest another way of achieving the same result, so that a
'Buy' transaction will produce one calculation, and a 'Sell' (or non-'Buy)
transaction will produce another?

cheers




jake

cheers all, typically enough i figured this out myself immediately after
posting. when excel help illustrates the use of the IF function it uses
square brackets for some reason...

thanks anyway :)


"Bob Phillips" wrote:

=IF(B3="Buy", G3*(F3-E3), G3*(E3-F3))

--

HTH

RP
(remove nothere from the email address if mailing direct)


"jake" wrote in message
...
can anyone tell me why the following doesn't work?

=IF(B3="Buy", [G3*(F3-E3)], [G3*(E3-F3)])

or possibly suggest another way of achieving the same result, so that a
'Buy' transaction will produce one calculation, and a 'Sell' (or non-'Buy)
transaction will produce another?

cheers






All times are GMT +1. The time now is 09:20 AM.

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