vba - Excel 2010 - Take whole rows from one sheet and display them in the 2nd sheet based on match in 3rd sheet -


i'll cut chase:

excel 2010

i have sheet1 list of orders. customer name in column f.

sheet2 contains list of customers names in column a.

i run macro / vlookup / index (whatever works) run through list of thousands of orders in sheet1 , copy sheet3 rows (whole rows) customer name sheet2 matches.

sheet1 has 10 columns , 10000 rows. sheet2 has 50 rows in column only.

i have tried few types of macros , did proper search couldn't find work. paste have embarrassment.

i might add need run weekly , list of orders changing. list of names may little frequency.

can help? :)

edit: answers far can see need use vba script. appreciate know next nothing language. should able manage modifying script suit needs need start. perhaps pseudocode make easier people:


read data a1:a50 in sheet2

compare f1, sheet1 a1:a50, sheet2

if no match - continue f2

if match - copy whole row a1 in sheet3

(...)

compare fx, sheet1 a1:a50, sheet2

if no match - continue fx+1

if match - copy whole row a(n+1) [n=number of matches] in sheet3

continue comparing rows in sheet1 a1:a50, sheet2 , return next match in an, sheet3


so far have problem returns data sheet3 only if row number in sheet2 matches row number in sheet1. also, returns sheet3, row number matching sheet1. end 1 result in row 45 in sheet3 instead of around 20 results in rows 1-20.

sub asd() counter = 1 sheets(1).usedrange.rows.count     if sheets(1).range("f" & counter).value = sheets(2).range("a" & counter).value       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

i believe you'll need use vba script copy entire row.

please make sure data in both sheets 1 & 2 sorted if wish use vlookup, don't think since vlookup "stop" on first hit, meaning if have customer names john on sheet1 repeats several times, vlookup pick first occurrence

regards,


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

html - Why is a table with width of 75% wider than three tables which total 99%? -