I am trying to put this into an excel formula:
If H1=quot;Sellquot; and K1lt;D1 then (K1-D1)*L1*100 otherwise (D1-K1)*l1*100 OR If
H1=quot;Buyquot; and K1lt;C1 then (K1-C1)*L1*100 otherwise (C1-K1)*L1*100
Thank you in advance.
I'm not entirely sure where the 'otherwise' statements apply relative to the
multiple IFs, but my hunch is:
=if(h1=quot;Sellquot;,-abs(D1-K1)*L1*100,if(h1=quot;Buyquot;,-abs(K1-C1)*L1*100,quot;Invalid
transaction typequot;))
--Bruce
quot;carlquot; wrote:
gt; I am trying to put this into an excel formula:
gt;
gt; If H1=quot;Sellquot; and K1lt;D1 then (K1-D1)*L1*100 otherwise (D1-K1)*l1*100 OR If
gt; H1=quot;Buyquot; and K1lt;C1 then (K1-C1)*L1*100 otherwise (C1-K1)*L1*100
gt;
gt; Thank you in advance.
Thank you Bruce. I've re-written my question:
If H1=quot;Sellquot; and K1lt;D1 then (K1-D1)*L1*100 else (D1-K1)*l1*100 OR If
H1=quot;Buyquot; and K1lt;C1 then (K1-C1)*L1*100 else (C1-K1)*L1*100
Your earlier formula did not get me the result needed. Does this make it
clearer ?
Thanks again.
quot;bpeltzerquot; wrote:
gt; I'm not entirely sure where the 'otherwise' statements apply relative to the
gt; multiple IFs, but my hunch is:
gt; =if(h1=quot;Sellquot;,-abs(D1-K1)*L1*100,if(h1=quot;Buyquot;,-abs(K1-C1)*L1*100,quot;Invalid
gt; transaction typequot;))
gt; --Bruce
gt;
gt; quot;carlquot; wrote:
gt;
gt; gt; I am trying to put this into an excel formula:
gt; gt;
gt; gt; If H1=quot;Sellquot; and K1lt;D1 then (K1-D1)*L1*100 otherwise (D1-K1)*l1*100 OR If
gt; gt; H1=quot;Buyquot; and K1lt;C1 then (K1-C1)*L1*100 otherwise (C1-K1)*L1*100
gt; gt;
gt; gt; Thank you in advance.
Not really; I think you're confusing the OR with another level of IFs. I
think the formula does what your words say. My interpretation of your text
(with indentation to help clarify the interpretation):
IF H1=Sell THEN
IF K1lt;D1 THEN
(K1-D1)*L1*100 ' note this will be negative since K1lt;D1
ELSE
(D1-K1)*L1*100 ' likewise
END IF
ELSE
IF H1=Buy THEN
IF (K1lt;C1) THEN
(K1-C1)*L1*100 ' still negative; K1 lt; C1.
ELSE
(C1-K1)*L1*100 ' likewise
END IF
ELSE
Error
END IF
END IF
Perhaps you could provide a few examples?
--Bruce
(BTW, you should stay w/in the same thread if addressing the same issue).
quot;carlquot; wrote:
gt; Thank you Bruce. I've re-written my question:
gt;
gt; If H1=quot;Sellquot; and K1lt;D1 then (K1-D1)*L1*100 else (D1-K1)*l1*100 OR If
gt; H1=quot;Buyquot; and K1lt;C1 then (K1-C1)*L1*100 else (C1-K1)*L1*100
gt;
gt; Your earlier formula did not get me the result needed. Does this make it
gt; clearer ?
gt;
gt; Thanks again.
gt;
gt; quot;bpeltzerquot; wrote:
gt;
gt; gt; I'm not entirely sure where the 'otherwise' statements apply relative to the
gt; gt; multiple IFs, but my hunch is:
gt; gt; =if(h1=quot;Sellquot;,-abs(D1-K1)*L1*100,if(h1=quot;Buyquot;,-abs(K1-C1)*L1*100,quot;Invalid
gt; gt; transaction typequot;))
gt; gt; --Bruce
gt; gt;
gt; gt; quot;carlquot; wrote:
gt; gt;
gt; gt; gt; I am trying to put this into an excel formula:
gt; gt; gt;
gt; gt; gt; If H1=quot;Sellquot; and K1lt;D1 then (K1-D1)*L1*100 otherwise (D1-K1)*l1*100 OR If
gt; gt; gt; H1=quot;Buyquot; and K1lt;C1 then (K1-C1)*L1*100 otherwise (C1-K1)*L1*100
gt; gt; gt;
gt; gt; gt; Thank you in advance.
- Dec 18 Mon 2006 20:34
Help with an IF Formula
close
全站熱搜
留言列表
發表留言