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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Cindy Ellis

MrExcel MVP
Joined
Jun 9, 2006
Messages
1,802
The "OR" is what's messing up the formula.
Instead try =IF(B4="Short", E5-H5, If( B5="Long",H5-E5,""))
Hope that helps,
 

Cindy Ellis

MrExcel MVP
Joined
Jun 9, 2006
Messages
1,802
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:

Forum statistics

Threads
1,137,292
Messages
5,680,645
Members
419,923
Latest member
Kalthus

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
Top