# "IF" "And"

#### Boler

##### New Member
How can set up a condition question for a cell using both the "if" function and the "and" function. Do I separate them with a comma? example:
If this number equals 10 and if it equals 2

### Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

#### Zack Barresse

##### MrExcel MVP
=IF(AND(condition1,condition2),iftrue,iffalse)
or
=IF(AND(condition1,condition2),iftrue,) will display FALSE if both are not met.

edit:
=IF(AND(condition1,condition2),iftrue)
2nd formula - no comma at the end - sorry.

#### al_b_cnu

##### Well-known Member
Hi,

surely that condition will never be true?

but do you mean

=IF(AND(A1>=2,A1<=10),"Y","N")

HTH

Alan

#### earlyd

##### Well-known Member
A number cannot equal both 10 and 2, but this would work...
=IF(And(A2=10,B2=2),"Yes","No").

#### Andrew Poulsom

##### MrExcel MVP
Or maybe it's:

=IF(OR(A1=2,A1=10),"Y","N")

#### Zack Barresse

##### MrExcel MVP
andrew's is good if you want either/or of the conditions to be met. simple, yet effective.

good luck.

#### Ben Wright

##### New Member
I believe you can also embedd the IF functions without the need to use AND

so at the end where you might have something like IF(.....etc)=0,TRUE,FALSE) place a second IF so it's something like IF(.....etc)=0,(IF(....etc)etc),FALSE)
This way only if both IF results in a TRUE you get a TRUE otherwise you will get a FALSE

#### north19701

##### Active Member
problem with that is you can only nest 7 if statements, while and AND function can take up to 30 arguments.

Replies
3
Views
133
Replies
1
Views
28
Replies
3
Views
54
Replies
4
Views
234
Replies
1
Views
156

1,186,808
Messages
5,959,928
Members
438,454
Latest member
leopedrini

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