=ABS

M

Mukesh

I need to calculate margin required for trading,
if there is 1 buy & 1 sell, I need result as 1 & -1,
for example:

cell cell
A7 buy B7 1
A9 buy B9 1
A10 sell B10 2

So far my formula in cell H10 is :
=IF(OR(A10="buy",A10="sell"),ROUND(((H$3*B10)*1000*0.05)*C10,2)," ")

how do I make it work to give me a -ve result? please help.

Thanks.
Mukesh
 
M

Mukesh

what I want to do is basically balance both sides.
1 buy & 1 sell = 0
2 buy & 1 sell = +1 or if its
2 sell & 1 buy = -1 and so on.....

A B
21 sell 1
23 sell 1
24 buy 2
25 buy 1
26 sell 2

How I do I put it in formula? your help is highly apprecaited.

Thanks.
Mukesh
 
O

OssieMac

Try this and see if it returns what you want.

=SUMIF(A21:A26,"buy",B21:B26)-SUMIF(A21:A26,"sell",B21:B26)
 
M

Mukesh

Just perfect, thanks a ton.

Mukesh



OssieMac said:
Try this and see if it returns what you want.

=SUMIF(A21:A26,"buy",B21:B26)-SUMIF(A21:A26,"sell",B21:B26)
 
M

Mukesh

This fomula works fine
=SUMIF(A21:A26,"buy",B21:B26)-SUMIF(A21:A26,"sell",B21:B26)

but if I have
=SUMIF(A21:A26,"buy",B21:B26)-SUMIF(A21:A26,"sell",B21:B26)*100
I am getting a wrong answer, what could be wrong?

Thanks.
Mukesh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top