how to use if and then in excel

S

Satnam Randhawa

I want to confirm that if a2 in sheet 1 is equal to b2 in sheet2 then a3 in
sheet1 should be equal to b3 in sheet2. I am trying to use the if and then
conditions for the same but i believe i dont know the right syntax to get
there.
 
R

RagDyeR

This should be placed in A3 of Sheet1:

=IF(A2=Sheet2!B2,Sheet2!B3,"")


--

HTH,

RD
=====================================================
Please keep all correspondence within the Group, so all may benefit!
=====================================================

message I want to confirm that if a2 in sheet 1 is equal to b2 in sheet2 then a3 in
sheet1 should be equal to b3 in sheet2. I am trying to use the if and then
conditions for the same but i believe i dont know the right syntax to get
there.
 
K

Kevin B

I'm assuming that you want this formula in A3 and if A2 in sheet 1 is not
equal to B2 in sheet 2 you want nothing displayed in the cell.

In A2 enter the following:

=IF(A2=Sheet2!B2,Sheet2!B3,"")

If you want a 0 (zero) in the cell replace the double quotes in the ELSE
clause of the IF with the number 0.
 
I

iliace

I want to confirm that if a2 in sheet 1 is equal to b2 in sheet2 then a3 in
sheet1 should be equal to b3 in sheet2. I am trying to use the if and then
conditions for the same but i believe i dont know the right syntax to get
there.

In A3 on sheet1, use this formula:

=IF('Sheet1'!A2='Sheet2'!B2,'Sheet2'!B3)

If A2 on sheet 1 does not equal B2 on sheet 2, this formula will
return FALSE.
 
J

joeu2004

I want to confirm that if a2 in sheet 1 is equal to b2 in sheet2 then a3 in
sheet1 should be equal to b3 in sheet2. I am trying to use the if and then
conditions for the same but i believe i dont know the right syntax to get
there.

It is unclear to me whether you want to set sheet1!a3 to sheet2!b3 if
conditions are met, or if you want verify ("confirm") that sheet1!a3
equals sheet2!b3 at the same time that sheet1!a2 equals sheet2!b2, as
you wrote. In other words, you want a TRUE or FALSE result. If the
latter, the following is one way:

=if(sheet1!a2 = sheet2!b2, if(sheet1!a3 = sheet2!b3, TRUE, FALSE), "")

or more simply:

=if(sheet1!a2 = sheet2!b2, (sheet1!a3 = sheet2!b3), "")

(The inner parentheses are unnecessary; they are there only to improve
readability.)

That leaves the cell looking blank if the first condition is not met.
 
Top