# The IF function with extra

#### RoydenC

##### Board Regular
My problem is easy, as I have seen it sorted before, but am havibng difficulty doing it again
I want to select information in cell only if it is between two Values ( eg greater than 0 but less than say 10) then include the contents of that cell in the calculation...
ie =IF((D3+D8)<0....." but less than 10" etc etc - how do you set up this formula ?
Thanks

### Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

#### Derek

##### Well-known Member
Hi there
For an IF statement that gives a return only when D3+D8 is between 0 and 10 inclusive, you need a formula something like this:

=IF(AND(D3+D8>=0,D3+D8<=10),DO SOMETHING,DO SOMETHING ELSE)

The IF condition comes before the first comma, the result you want if the condition is true comes after the first comma, the result you want if the condition is false comes after the second comma.

hope this helps
regards
Derek
PS If you do not want to include 0 or 10 use the >< signs rather than >=<= signs
This message was edited by Derek on 2002-10-17 04:09

#### Andrew Poulsom

##### MrExcel MVP
Like this:

=IF(AND((D3+D8)>0,(D3+D8)<10),D3+D8,0)

#### RoydenC

##### Board Regular
Derek and Andrew,
Thanks - thats just what I wanted

Replies
6
Views
134
Replies
1
Views
168
Replies
6
Views
1K
Replies
2
Views
471
Replies
12
Views
1K

1,181,461
Messages
5,930,063
Members
436,718
Latest member
messa57fr

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