Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 78
Default IF Statement (AND/OR)


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(F50,F5+0.005," "),IF(B5="buy",IF(F50,F5-0.005," ")))

Thanks.
Mukesh

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 345
Default IF Statement (AND/OR)

I think this may give you what you want:
=IF(AND(OR(B5="Buy",B5="Sell"),I5="-"),(G5-F5)*E5*1000,IF(AND(B5="Buy",I5="+"),(H5-F5)*E5*1000,IF(AND(B5="Sell",I5="+"),(F5-H5)*E5*1000,"")))
But I'm sure there is a more compact formula in there somewhere.
(Why multiply E5 by 1000 in the formula, why not just enter your data with
three 0s or custom format the cell?)


"Mukesh" wrote:


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(F50,F5+0.005," "),IF(B5="buy",IF(F50,F5-0.005," ")))

Thanks.
Mukesh

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 345
Default IF Statement (AND/OR)

In answer to your second problem, your FALSE statement can be replaced with a
blank using:
=IF(AND(B5="Sell",F50),F5+0.005,IF(AND(B5="Buy",F 50),F5-0.005,""))


"Ron@Buy" wrote:

I think this may give you what you want:
=IF(AND(OR(B5="Buy",B5="Sell"),I5="-"),(G5-F5)*E5*1000,IF(AND(B5="Buy",I5="+"),(H5-F5)*E5*1000,IF(AND(B5="Sell",I5="+"),(F5-H5)*E5*1000,"")))
But I'm sure there is a more compact formula in there somewhere.
(Why multiply E5 by 1000 in the formula, why not just enter your data with
three 0s or custom format the cell?)


"Mukesh" wrote:


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(F50,F5+0.005," "),IF(B5="buy",IF(F50,F5-0.005," ")))

Thanks.
Mukesh

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 78
Default IF Statement (AND/OR)

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(F50,F5+0.005," "),IF(B5="buy",IF(F50,F5-0.005," ")))
please correct me.

Thanks for your help.
Mukesh




"Ron@Buy" wrote:

I think this may give you what you want:
=IF(AND(OR(B5="Buy",B5="Sell"),I5="-"),(G5-F5)*E5*1000,IF(AND(B5="Buy",I5="+"),(H5-F5)*E5*1000,IF(AND(B5="Sell",I5="+"),(F5-H5)*E5*1000,"")))
But I'm sure there is a more compact formula in there somewhere.
(Why multiply E5 by 1000 in the formula, why not just enter your data with
three 0s or custom format the cell?)


"Mukesh" wrote:


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(F50,F5+0.005," "),IF(B5="buy",IF(F50,F5-0.005," ")))

Thanks.
Mukesh

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 78
Default IF Statement (AND/OR)

Thank you.


"Ron@Buy" wrote:

In answer to your second problem, your FALSE statement can be replaced with a
blank using:
=IF(AND(B5="Sell",F50),F5+0.005,IF(AND(B5="Buy",F 50),F5-0.005,""))


"Ron@Buy" wrote:

I think this may give you what you want:
=IF(AND(OR(B5="Buy",B5="Sell"),I5="-"),(G5-F5)*E5*1000,IF(AND(B5="Buy",I5="+"),(H5-F5)*E5*1000,IF(AND(B5="Sell",I5="+"),(F5-H5)*E5*1000,"")))
But I'm sure there is a more compact formula in there somewhere.
(Why multiply E5 by 1000 in the formula, why not just enter your data with
three 0s or custom format the cell?)


"Mukesh" wrote:


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(F50,F5+0.005," "),IF(B5="buy",IF(F50,F5-0.005," ")))

Thanks.
Mukesh

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
If statement or lookup statement not sure Renegade40 Excel Worksheet Functions 2 January 18th 09 06:11 AM
SUMIF statement with AND statement Eric D Excel Discussion (Misc queries) 2 July 14th 08 07:24 PM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM
If statement and Isblank statement Rodney C. Excel Worksheet Functions 0 January 18th 05 08:39 PM


All times are GMT +1. The time now is 08:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"