Searching 2 columns of data that contain both text and numbers. Vlookup, Index(Match and VBA code dont work

Saltysteve

New Member
Joined
Jul 23, 2014
Messages
36
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have 2 columns of data contain ID numbers, which include text and numbers, although some are numbers only as follows
d3856609
3b758509
3d758509
3758509​
40194854​
77ab49a9
5903c2ce

Sorry can't adjust the column width, so the numbers are way over there on the right.

I have tried VLOOKUP (using varying match types) , INDEX(MATCH) and VBA but none will work, I think because of the formatting issues. The following code does work when I swap some of the IDs to just numbers.

Sub Test()

'Declare variables
Dim c, d
Dim Calcs, Data As Worksheet

'Name variables
Set Data = Sheets("Sheet1")
Set Calcs = Sheets("Sheet2")

d = Data.UsedRange.Rows
c = Calcs.UsedRange.Rows

For i = 2 To UBound(c) 'Sets the row in the Calcs sheet

For ii = 2 To UBound(d) 'Sets the row in the Data sheet

If Calcs.Cells(i, 10) = Data.Cells(ii, 6) Then Calcs.Cells(i, 12).Value = Data.Cells(ii, 7)
Next ii
Next i

End Sub

Does anyone know a work around for this? Sheet 1 contains 4500 rows of data and Sheet 2, 350

Look forward to any help that can be offered.
 
Thanks for your tenacity. Following link takes you to a cleaned up version of the sheet with a lot of the rows removed also.

Test.xlsm
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
In looking at your sample file, I cannot find a single ID on Sheet2 that matches any of the IDs on Sheet1.
I put all the IDs together in a list and sorted it, and could find any matches when visually going through the entire list.
Based on that sample file, can you give me an example of one that matches? Tell me the row number on Sheet1 that matches a specific row number on Sheet2.
 
Upvote 0
I am astounded by that. Firstly that a expected there to be matches and didn't check that myself first and secondly that there are no matches. I am so sorry to have wasted your time with this. I will need to raise it with the company that provides the data as there definitely should be matches.

Again, so sorry.
 
Upvote 0
Well, at least the mystery is now solved, and you know it wasn't a problem with your formulas!
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,986
Members
449,058
Latest member
oculus

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