"IF" "And"

Boler

New Member
Joined
Nov 3, 2002
Messages
31
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 :rolleyes:
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
=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.
 
Upvote 0
Hi,

surely that condition will never be true?

but do you mean

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

HTH

Alan
 
Upvote 0
A number cannot equal both 10 and 2, but this would work...
=IF(And(A2=10,B2=2),"Yes","No").
 
Upvote 0
andrew's is good if you want either/or of the conditions to be met. simple, yet effective.

good luck.
 
Upvote 0
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
 
Upvote 0
problem with that is you can only nest 7 if statements, while and AND function can take up to 30 arguments.
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

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