Sum of a cell if certain criteria are met.

S

Steve

I know this is probably easy, but for some reason I am having a hard time
with it. Here's what I want to do.

IF A1=L THEN C1-B1
IF A1=S THEN B1-C1

Not that it matters, but L=Long, S=Short (I trade stocks) If I take a long
position, then I need to subtract the entry price from the exit price and
vice versa.

I would like the sum of that to appear in the cell I put that formula in.

Any help would be great!

Thanks again!
 
S

Sandy Mann

If A1 can only hold L or S then:

=IF(A1="L",C1-B1,B1-C1)

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

[email protected]
Replace @mailinator.com with @tiscali.co.uk
 
F

Farhad

Hi,

Try this:

=IF(A1=L,C1-B1,IF(A1=S,B1-C1,""))

you didn't mention that what should happen if A1 would not be L or S. so i
put nothing ("").

Thanks,
 
Top