Formula question

  • Thread starter Thread starter Tommy
  • Start date Start date
T

Tommy

Three columns:

b 1250 1253

s 1250 1253

If column a equals "b" for buy, I want to subtract column b from
column c. If column a equals "s" for sell, then I want to subtract
column c from column b.

I'm looking for a formula in column d that will get the desired
results.

Thanks.
 
If column A will contain ONLY a B or an S, you can write this IF
function:
=IF(A1="b",C1-B1,B1-C1)
 
If your data begins in row 2, then in D2:
if(a2="b",c2-b2,if(a2="s",b2-c2,"?")). Autofill that formula through each
row in column D. If you're confident that ONLY b or s will appear in column
A, you could make this =(c2-b2)*if(a2="b",1,-1).
 
Back
Top