The logic for If statements in excel is as follows:
=if(logic test, true, false)
So, with that in mind, if your data starts with:
In cell C1, you could have the formula of:
=if(A1=B1,"There are both apples","they do not match")
Now, that we have the first logic statement, we can nest other logical tests in the first If statement for:
=If(A1=B1,IF(someothervalue=sometest,"the first test was true, and so was the scond test","the first test was true, but the second test is false"),"Failed the first test because they do not match")
Let me know if that gets you further. We will tackle to second part of your solution after you understand the logic tests.
I understand you are looking for VBA code, this is in formula bar n the sheet itself, and does not require a module.
Please post back.