If/AND/Or Formula Help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I tried but cannot get a formula to give me the result.

I am looking for a formula for ColH (Calc) that will do the following:

If Name1 OR Name2 is Fred And Type is A, For Side=Sell (PriceB-Price), For
Side=Buy (Price-PriceB)

Name1 Name2 Side Type Price PriceA PriceB Calc
Fred Blank Buy A 2 2 3 1
Blank Fred Sell A 5 4 6 1

Thank you in advance.
 
In cell H2:

=IF(AND(OR(A2="Fred",B2="Fred"),D2="A"),IF(C2="Sell",G2-E2,E2-G2),"")

And copy down to match.

HTH,
Bernie
MS Excel MVP
 
Thank you Bernie. If I change the logic slightly from:

If Name1 OR Name2 is Fred And Type is A, For Side=Sell (PriceB-Price), For
Side=Buy (Price-PriceB)

To:

If Name1 and Name3 OR Name2 is Fred And Type is A, For Side=Sell
(PriceB-Price), For Side=Buy (Price-PriceB)

How would the formula change.

Also. If the formula is False, can I make it return 0 "zero" ?

Thank you again.
 
Assuming Name 3 is in column C, and everything in D:G shifts to the right, in cell I2, use

=IF(AND(OR(AND(A2="Fred",C2="Fred"),B2="Fred"),E2="A"),IF(D2="Sell",H2-F2,F2-H2),0)

HTH,
Bernie
MS Excel MVP
 

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

Back
Top