Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Embedding an OR statement in an IF statement efficiently | Excel Discussion (Misc queries) | |||
If statement or lookup statement not sure | Excel Worksheet Functions | |||
SUMIF statement with AND statement | Excel Discussion (Misc queries) | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions | |||
If statement and Isblank statement | Excel Worksheet Functions |