I have two sheets with three columns each. I need a third sheet in which I have all rows that are in sheet two b开发者_开发百科ut not in sheet one. Is there a formula to do this?
Here are the formulas in separate columns (for clarity). You may combine them, of course.
I used columns in a worksheet instead of separate worksheets, but the concept carries over.
Column A Column B
a d
b e
c f
d g
e h
These are A1:B6. Your data under examination are A2:A6 and B2:B6.
If I understand your question, you are looking for "f, g, h" Those are the rows in column B that are not in column A.
In C2, I place the formula =MATCH(B2,$A$2:$A$6,0)
. The $A$2:$A$6
means use the absolute column and row and does not change when I copy the formula down to C6. The 0 means I want an exact match.
This will put a 4 and 5 in cells C2 and C3, but #N/A in C4, C5, and C6, because there is no match.
In D2, I place the formula =IF(ISERROR(C2),B2,"")
. Also copy this formula to column D6. If there is a number in C2, then the a match was found, and it prints a blank. If there is a #N/A in C2, then it prints the letter in column B.
In my small example, it prints f, g, and h.
Column C Column D
4
5
#N/A f
#N/A g
#N/A h
精彩评论