Help needed for FIND Method

22strider

Active Member
Joined
Jun 11, 2007
Messages
311
Hello Friends

Could you please help me with the following:

I am using "FIND" method for comparing two columns in 2 spreadsheets. So if cell value in sheet1 matches with cell value in sheet2 then copy multiple columns from sheet2 to sheet1 (similar to what VLOOKUP does but I need to return multiple values if the comparison is true).

Values that I comparing are in Column A in both the sheets. Is match I need to return values from about 20 columns (from sheet2 to sheet1). One value that I am returning is in Column B, I was able to get that working. but other values are in columns starting from M. I do not know how to get those values from Sheet2 to Sheet1.

Following is the portion of code that deals with this FIND method

Code:
Set wsTools = Worksheets("AllTools")
Set wsToolParts = Worksheets("Tools and Parts")

Set ToolPartsRange = wsToolParts.Range("A2:A" & lR)
Set AllToolRange = wsTools.Range("A2:A" & lR3)

For Each ToolPartsCells In ToolPartsRange

    Set ToolCells = AllToolRange.Find(What:=ToolPartsCells, LookIn:=xlValues, _
                      LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
                      MatchCase:=False, SearchFormat:=False)
    
    If Not ToolPartsCells Is Nothing Then
        
        ToolPartsCells.Offset(, 1) = ToolCells.Offset(, 1)
        
    End If
Next

As you may notice that the following line brings next column (B) back but I do not know how to get other column values. They are in columns from M to Z
Code:
ToolPartsCells.Offset(, 1) = ToolCells.Offset(, 1)

Thanks for your help
Rajesh
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
It's not clear for me, attac a link to a sample file with current and desired sheets.
this line If Not ToolPartsCells Is Nothing Then is wrong, you hav to change in
If Not ToolCells Is Nothing Then
 
Upvote 0
Hello

Please see my previous message for the question, I am attaching sample source and sample expected data:




Excel 2007
ABCDE
2Source1
3Manufacturer Part NumberManufacturer NameLifecycle PhaseTool1Tool2
410164MODERNUnassignedFair
5512504ABC INCUnassignedExcellent
6512505OPTEX INCUnassignedExcellent
7B0001CORPORATIONUnassignedExcellent
8B0002CORPORATIONUnassignedExcellent
9B0003CORPORATIONUnassignedExcellent
10B0004CORPORATIONUnassignedExcellent
11B0005CORPORATIONUnassignedExcellent
12B0011HONG KONGApprovedExcellent
Source1



Excel 2007
ABCD
2Source2
3Part NumberDescriptionManufacturers.MPN TypeTool
4ABCDRandom descriptionTool10164
5EFGHRandom descriptionTool512504
6XYZRandom descriptionTool512505
7LMNRandom descriptionToolB0001
8QRSRandom descriptionToolB0002
9GHRRandom descriptionToolB0003
10KHVRandom descriptionToolB0004
11XHDGRandom descriptionToolB0005
12BIFKRandom descriptionToolB0011
Source2



Excel 2007
ABCDE
2Result
3Part Number(From Source2)Tool (From Source2)Manufacturer Name (From Source1)Tool1 (From Source1)Tool2 (From Source1)
4ABCD10164MODERNFair
5EFGH512504ABC INCExcellent
6XYZ512505OPTEX INCExcellent
7LMNB0001CORPORATIONExcellent
8QRSB0002CORPORATIONExcellent
9GHRB0003CORPORATIONExcellent
10KHVB0004CORPORATIONExcellent
11XHDGB0005CORPORATIONExcellent
12BIFKB0011HONG KONGExcellent
Result


Thanks for your help
Rajesh
 
Last edited:
Upvote 0
Hello Patel45

I've posted sample source and sample result data; please review.

Thanks for your help
Rajesh
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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