View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default how to use if and then in excel

On Dec 26, 8:16*am, Satnam Randhawa
wrote:
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.