I'll cut to the chase:
Excel 2010
I have Sheet1 with a list of orders. Customer name is in column F.
Sheet2 contains list of customers with just their names in column A.
I would like to run a macro / vlookup / index (whatever works) to run through the list of thousands of orders in Sheet1 and copy to Sheet3 the rows (whole rows) where the customer name from Sheet2 matches.
Sheet1 has 10 columns and about 10000 rows.
Sheet2 has about 50 rows in column A only.
I have tried a few types of macros and did a proper search but couldn't find anything that would work. I would paste what I have but that would only be an embarrassment.
I might add that I will need to run this weekly and the list of orders will be changing. List of names may too but with little frequency.
Can you help? :)
EDIT: From the answers so far I can see that I would need to use VBA script. I would appreciate help with that as I know next to nothing about the language. I should be able to manage modifying the script to suit my needs but I need something to start. Perhaps this pseudocode will make it easier for you good people:
Read data from A1:A50 in Sheet2
Compare F1, Sheet1 with A1:A50, Sheet2
If no match - continue to F2
If match - copy whole row to A1 in Sheet3
(...)
Compare Fx, Sheet1 with A1:A50, Sheet2
If no match - continue to Fx+1
If match - copy whole row to A(n+1) [n=number of matches] in Sheet3
Continue comparing rows in Sheet1 to A1:A50, Sheet2 and return next match in An, Sheet3
So far I have something like this but the problem is that it returns data to Sheet3 only if row number in Sheet2 matches row number in Sheet1. Also, it returns it to Sheet3, row number matching Sheet1. So I end up with one result in row 45 in Sheet3 instead of around 20 results in rows 1-20.
Sub asd()
For Counter = 1 To Sheets(1).UsedRange.Rows.Count
If Sheets(1).Range("F" & Counter).Value = Sheets(2).Range("A" & Counter).Value Then
Sheets(3).Range("C" & (Counter)).Value = Sheets(1).Range("A" & Counter).Value
Sheets(3).Range("D" & (Counter)).Value = Sheets(1).Range("B" & Counter).Value
End If
Next Counter
End Sub
Thank you, Pat