IF Statement (AND/OR)

M

Mukesh

I want is :
IF B5="buy" & I5="+" ..result (H5-F5)*E5*1000
IF B5="buy" & I5="-" ..result (G5-F5)*E5*1000
IF B5="sell" & I5="+" ..result (F5-H5)*E5*1000
IF B5="sell" & I5="-" ..result (G5-F5)*E5*1000

I tried following code, it works well, but when I add same for "sell", it
doens't work,
please correct me.

=IF(AND(B5="buy",I5="+"),(H5-F5)*E5*1000,IF(AND(B5="buy",I5="-"),(G5-F5)*E5*1000))

I am getting FALSE instead of blank field, where am I wrong.
=IF(B5="sell",IF(F5>0,F5+0.005," "),IF(B5="buy",IF(F5>0,F5-0.005," ")))

Thanks.
Mukesh
 
M

Mukesh

Thanks Ron, that code worked nicely.
I multiply E5 by 1,000 because E5 cell has numbers in '000 and I need
to show them in 2 to 3 digits only...is there a way to format the cell?

what about - getting "FALSE" instead of blank field from this code
=IF(B5="sell",IF(F5>0,F5+0.005," "),IF(B5="buy",IF(F5>0,F5-0.005," ")))
please correct me.

Thanks for your help.
Mukesh
 
M

Mukesh

Thank you.


Ron@Buy said:
In answer to your second problem, your FALSE statement can be replaced with a
blank using:
=IF(AND(B5="Sell",F5>0),F5+0.005,IF(AND(B5="Buy",F5>0),F5-0.005,""))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top