Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
carl
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bpeltzer
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
carl
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bpeltzer
 
Posts: n/a
Default 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
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
2 Nesting questions Starchaser Excel Worksheet Functions 7 January 20th 06 06:53 PM
Formula Problem - interrupted by #VALUE! in other cells!? Ted Excel Worksheet Functions 17 November 25th 05 05:18 PM
Hide formula skateblade Excel Worksheet Functions 10 October 15th 05 08:36 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 03:28 AM
Match / Vlookup within an Array formula Hari Prasadh Excel Discussion (Misc queries) 3 February 3rd 05 04:37 PM


All times are GMT +1. The time now is 05:19 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"