"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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Zack Barresse

MrExcel MVP
Joined
Dec 9, 2003
Messages
10,881
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
  3. Web
=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
Joined
Jul 18, 2003
Messages
4,518
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
Joined
Dec 10, 2002
Messages
1,199
A number cannot equal both 10 and 2, but this would work...
=IF(And(A2=10,B2=2),"Yes","No").
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092

ADVERTISEMENT

Or maybe it's:

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

Zack Barresse

MrExcel MVP
Joined
Dec 9, 2003
Messages
10,881
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
  3. Web
andrew's is good if you want either/or of the conditions to be met. simple, yet effective.

good luck.
 

Ben Wright

New Member
Joined
Jan 20, 2004
Messages
4
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
Joined
Jun 17, 2003
Messages
491
problem with that is you can only nest 7 if statements, while and AND function can take up to 30 arguments.
 
Learn Excel from Bill Jelen

Understanding data is crucial, and the easiest place to start is with Microsoft Excel.

Forum statistics

Threads
1,151,491
Messages
5,764,679
Members
425,229
Latest member
Rashid mahmood

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