# IF OR Formula with Multiple Criteria

#### williamscheidt

##### New Member
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?

Bill

### Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

#### Cindy Ellis

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

#### vogel997

##### Active Member
Try this

=IF(B1="Short",E1-H1,H1-E1)

#### Cindy Ellis

##### MrExcel MVP
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:

#### williamscheidt

##### New Member
Hi Cindy and vogel977,

Cheers!
Bill

Replies
1
Views
655
Replies
2
Views
316
Replies
23
Views
1K
Replies
8
Views
679
Replies
3
Views
1K

1,170,930
Messages
5,872,762
Members
432,944
Latest member
mj02

### 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.

### Which adblocker are you using?

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

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