Formula/Macro to delete rows that do not meet criteria from a list
To delete the row automatically will require VBA
A non-programmatic method would is to use a helper column in sheet1, and put
=MATCH(A1, Sheet2!A$1:A$100,0) and copy down (change range references as
needed)
If you could have extra spaces in your data then
=MATCH(TRIM(A1), TRIM(Sheet2!A$1:A$100),0) and hit Control+Shift+Enter after
typing it in. Then copy down. If not entered properly, you'll get #VALUE
If there's a match it will return a number. If not it will return #N/A.
Copy, then click Edit/Paste Special - Values. Sort your data in Sheet1 using
this new row as the key. The #N/A's s/b bunched at the top or bottom.
Delete the rows w/#N/A, then delete the helper column.
"S Davis" wrote:
If I have a list of data on one sheet, is there any way I can use a
formula to compare another sheet to that list and delete rows that do
not meet the criteria?
(example - sheet 2 has a list of activities, so if cell a1 in sheet 1
does not match any of the activities listed in sheet 2 column a, then
the row will delete itself)
Probably not, but Im just curious.
|