Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Help with an IF Formula
I am trying to put this into an excel formula:
If H1="Sell" and K1<D1 then (K1-D1)*L1*100 otherwise (D1-K1)*l1*100 OR If H1="Buy" and K1<C1 then (K1-C1)*L1*100 otherwise (C1-K1)*L1*100 Thank you in advance. |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Help with an IF Formula
I'm not entirely sure where the 'otherwise' statements apply relative to the
multiple IFs, but my hunch is: =if(h1="Sell",-abs(D1-K1)*L1*100,if(h1="Buy",-abs(K1-C1)*L1*100,"Invalid transaction type")) --Bruce "carl" wrote: I am trying to put this into an excel formula: If H1="Sell" and K1<D1 then (K1-D1)*L1*100 otherwise (D1-K1)*l1*100 OR If H1="Buy" and K1<C1 then (K1-C1)*L1*100 otherwise (C1-K1)*L1*100 Thank you in advance. |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Help with an IF Formula
Thank you Bruce. I've re-written my question:
If H1="Sell" and K1<D1 then (K1-D1)*L1*100 else (D1-K1)*l1*100 OR If H1="Buy" and K1<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. "bpeltzer" wrote: I'm not entirely sure where the 'otherwise' statements apply relative to the multiple IFs, but my hunch is: =if(h1="Sell",-abs(D1-K1)*L1*100,if(h1="Buy",-abs(K1-C1)*L1*100,"Invalid transaction type")) --Bruce "carl" wrote: I am trying to put this into an excel formula: If H1="Sell" and K1<D1 then (K1-D1)*L1*100 otherwise (D1-K1)*l1*100 OR If H1="Buy" and K1<C1 then (K1-C1)*L1*100 otherwise (C1-K1)*L1*100 Thank you in advance. |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Help with an IF Formula
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 K1<D1 THEN (K1-D1)*L1*100 ' note this will be negative since K1<D1 ELSE (D1-K1)*L1*100 ' likewise END IF ELSE IF H1=Buy THEN IF (K1<C1) THEN (K1-C1)*L1*100 ' still negative; K1 < 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). "carl" wrote: Thank you Bruce. I've re-written my question: If H1="Sell" and K1<D1 then (K1-D1)*L1*100 else (D1-K1)*l1*100 OR If H1="Buy" and K1<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. "bpeltzer" wrote: I'm not entirely sure where the 'otherwise' statements apply relative to the multiple IFs, but my hunch is: =if(h1="Sell",-abs(D1-K1)*L1*100,if(h1="Buy",-abs(K1-C1)*L1*100,"Invalid transaction type")) --Bruce "carl" wrote: I am trying to put this into an excel formula: If H1="Sell" and K1<D1 then (K1-D1)*L1*100 otherwise (D1-K1)*l1*100 OR If H1="Buy" and K1<C1 then (K1-C1)*L1*100 otherwise (C1-K1)*L1*100 Thank you in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
2 Nesting questions | Excel Worksheet Functions | |||
Formula Problem - interrupted by #VALUE! in other cells!? | Excel Worksheet Functions | |||
Hide formula | Excel Worksheet Functions | |||
Formula checking multiple worksheets | Excel Worksheet Functions | |||
Match / Vlookup within an Array formula | Excel Discussion (Misc queries) |