looking at 2 cells

M

Mike Edward

In Excel 2002, I am attempting to find a formula that looks at 2 cell and
returns an answer if true another answer if false.



I would like to use "=if(A1=2 & b1=5, Sheet2!A1,0)" but it Excel will not
accept the "&". The eventual aim is to nest various ifs.



Is there another way to look at two cells and return an answer based on the
values in the two cells?



Mike Dove
 
P

Peo Sjoblom

=IF(AND(A1=2,B1=5),"do this","do that")

--
Regards,

Peo Sjoblom

(No private emails please)
 
C

Chip Pearson

Mike,

The & character is a text concatenation operator, not an AND
operator. Try

=IF(AND(A1=2,B1=5),Sheet1!A1,0)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
K

KL

Hi Mike,

You are very close...try this:

=IF(AND(A1=2,B1=5),Sheet2!A1,0)

or

=IF((A1=2)*(B1=5),Sheet2!A1,0)

or if Sheet2!A1 is numerical value:

=(A1=2)*(B1=5)*Sheet2!A1

Regards,
KL
 
Top