vba - How to compare a list of rows to another list of rows in Excel? -
i trying figure out if there differences between list of data another. in order row of data "match" row, row must have same values in corresponding column. rows not have in particular order. in particular, dealing parts list, there part numbers, descriptions, etc. trying figure out if rows of data different rows of data list.
i found compare 2 sheets using arrays, may have answer problem, having trouble figuring out how adapt code due inexperience in visual basic.
i able work single column of data, comparing 1 column of data 1 sheet another, cannot compare entire rows of data.
here example of want work:
sheet 1 sheet 2 column 1 column 2 column 1 column 2 row 1 22a 33 11 11 row 2 22a 33a 22a 33 row 3 55 22b 55 23b
the code in link tell not in sheet 1 in sheet 2 , vice versa. in example, code tell me sheet 1 row 2 , sheet 1 row 3 not in sheet 2, , sheet 2 row 1 , sheet 2 row 3 not in sheet 1 (sheet 1 row 1 , sheet 2 row 2 match).
if ok you, can without vba using following formula:
={if(iferror(match(a1&"|"&b1;sheet7!$a$1:$a$3&"|"&sheet7!$b$1:$b$3;0);-1)=-1;"unique";"")}
assuming each of tables start in a1 (so tables 3 entries span a1:b3), , entering formula c1 (and copying down), press ctrl+shift+enter when entering formula create array formula, show word "unique" in column c if pair in row on sheet not in of row-pairs on sheet 2.
you can use conditional formatting highlight unique rows, filter on tables include unique rows, or other way of doing need.
note 1: have entered numbers in sheet6 , sheet7 instead of 1 , 2. formula written above goes sheet6.
note 2: language use ; instead of , function separator, if yours use , need change that.
note 3: need expand ranges sheet7!$a$1:$a$3 , sheet7!$b$1:$b$3 if set grows (this happen automatically if new rows inserted in between old ones). best still create named ranges each of 4 columns, exchange references those, , manage named ranges instead of formulas.
note 4: if data set contains character "|", need change well, match character sure not have there.
alternatively in column c on each cheet enter (assuming first entry in c1)
=a1&"|"&b1"
and copy down, run solution copied example using c column instead of on a1 , b1.
Comments
Post a Comment