Compare two sheets for a match and copy entire row

htou

New Member
Joined
Oct 31, 2002
Messages
34
Hello again,

Ive been googling for a result and I cant seem to get the right solution so im back for some help.

Worksheet 1 has data in a single column, range A1:A615 (Range A). Worksheet 2 contains data across columns and rows, range A1:AL1003 (Range B). Where data in Range A matches data in a specific column in Range B; I would like copy the entire row. The specific Column in Range B is Column F.

I started with <i>Vlookups</i> but i couldn't get it to work for multiple columns. Read about <i>Match</i> and <i>Index</i> but the samples ive looked at online werent exactly working for me. Is this do-able with formulas?

Better explained with an example.
Data in Sheet 1 - Sample (actual range is A1:A615)

Excel 2010
A
1101B2911
2102B2911
3102N6211
4102USL39717
5103B2911
Sheet1

Data in Sheet 2 - Sample (actual range is A1:AL1003, includes headings)

Excel 2010
ABCDEFGHIJKLMNO
1FIDShapePCCC_preLIDCIDLIDCIDPITNumPITNumPAR_INDAREAEXCL_AREAVOLUMEINDPRC
2143Polygon901102USL39717102USL3971736899536899005023700000N3290
3124Polygon818103USL39717103USL39717368996368990060567000N3290
4130Polygon82912B226312B2263397172739717027060700Y3290
5131Polygon83019B226319B2263397172039717020065000Y3290
6140Polygon8938USL393958USL3939539395839395008013000000N1405
7557Polygon474101B2911101B29113897444389740440101200Y5227
8619Polygon561102B2911102B29113897445389740450101200Y5227
9844Polygon873103B2911103B29113897493389740930101200Y5227
10134Polygon8857FD10257FD10256034256034200501641000Y799
11126Polygon825102N6211102N621123565223560520247400Y1953
12132Polygon833305G9661305G96612357842357084080900Y1953
13135Polygon8882F93442F934423561052356105078400Y1953
14136Polygon8895F93435F934323561512356151080900Y1953
15137Polygon89012F934412F934423561152356115071100Y1953
16138Polygon891304G9661304G96612357832357083087800Y1953
17139Polygon892209G9661209G96612357522357052095600Y1953
18141Polygon895193USL2356193USL23562356133235613303090000N1953
19142Polygon897138USL2356138USL2356235613823561380535000N1953
20133Polygon88029DS54629DS5463644033644000303750000N4441
Sheet2

Essentially the result im chasing. Where data in Column F in sheet 2 matches data in Range A, the entire row is copied to adjoining cell-

Excel 2010
ABCDEFGHIJKLMNOP
1101B2911557Polygon474101B2911101B29113897444389740440101200Y5227
2102B2911619Polygon561102B2911102B29113897445389740450101200Y5227
3102N6211126Polygon825102N6211102N621123565223560520247400Y1953
4102USL39717143Polygon901102USL39717102USL3971736899536899005023700000N3290
5103B2911844Polygon873103B2911103B29113897493389740930101200Y5227
Sheet1
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Put this formula in cell B2 in sheet1
Code:
=INDEX(Sheet2!$A$1:$AL$1003,MATCH($A1,$A$1:$A$615,0),COLUMN(A$1))
copy formula over and down
 
Upvote 0
When i copy down and across the formula it "copies" everything from sheet 2. It doesn't necessarily copy the row containing the matched value only.

A small sample of the results

Excel 2010
ABCDEFGHIJKLMNOP
1101B2911FIDShapePCCC_preLIDCIDLIDCIDPITNumPITNumPAR_INDAREAEXCL_AREAVOLUMEINDPRC
2102B29110Polygon5128NPW700128NPW70039718383971803808640000000N3290
3102N62111Polygon6128NPW700128NPW7003938653938600508640000000N1405
4102USL397172Polygon1220AP2105320AP21053235619223561920883000N1953
5103B29113Polygon2617SP19790817SP1979082294641229464101036000Y202
6103N62114Polygon282SP2611612SP2611612294709229470901171000Y202
7103USL397175Polygon596SP2008376SP20083739723679397236790587000000Y3374
8104B22616Polygon682SP1979082SP19790815325135153251350718200Y202
Sheet1
 
Upvote 0
Oh really
the last formula was without making example
but now I copied the example to sheet
this is the true formula:
Code:
=INDEX(Sheet2!$A$1:$AL$1003,MATCH($A1,Sheet2!$F$1:$F$1003,0),COLUMN(A$1))
try it and tell me the results
 
Upvote 0
Awesome mas123, you sir are a legend...unless you're female then you are a goddess!

Its funny i was so close to getting this formula to work myself last night then my PC shut-down. I gave up and went to sleep. Thank you again :)
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,246
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top