IF OR Formula with Multiple Criteria

williamscheidt

New Member
Joined
Dec 7, 2013
Messages
31
Hi all,

Can anyone help with a correction to a formula I'm working on? I think I may be pretty close, but just not quite there. Here's what I've got:

Column B is a text value, "Long" or "Short" (the name of the column is Entry Signal)
Column E is a numerical value (the name of the column is Entry Value)
Column H is a numerical value (the name of the column is Exit Value)

I'm looking for a formula such that when the value of column B is "short", the cell returns a value of E minus H; and when the value of column B is "long", the cell returns a value of H minus E.

What I've got at the moment is: =IF(OR(B5="Short",B5="Long"),E5-H5,H5-E5)
The problem I'm encountering with this formula is that it is treating each row as if the value of B is "short." In other words, it always returns the value of E minus H.

Any thoughts?

Thanks in advance!
Bill
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
The "OR" is what's messing up the formula.
Instead try =IF(B4="Short", E5-H5, If( B5="Long",H5-E5,""))
Hope that helps,
 
Upvote 0
The "OR" is what's messing up the formula.
Instead try =IF(B5="Short", E5-H5, If( B5="Long",H5-E5,""))
Hope that helps,
EDIT of above post...sorry for any confusion.
Also, Vogel997's formula will work fine if column B can ONLY have "Long" or "Short".
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,017
Members
448,936
Latest member
almerpogi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top