2 step search - find results in search result

marcoh

New Member
Joined
Sep 24, 2018
Messages
5
Hi forum, I'm new here and I've been having a problem to do a 2 step search.
Let me (try to) explain:

I've got 2 tables I need to compare

Table A (30 records)
name, Street, zip, town, Value 1

Table B (50000 records)
name, Street, zip, town

Step 1 - Compare the following to narrow it down
street, zip, town

Step 2 - once I've got a search result of step 1
compare the names from Table A with the result form Step 1

Step 3
Write the results from step 2 including "Value 1" of the Table A
name, street, zip, town, Value 1

I think I need to do 2 steps becuase the [name] in table A is mixed. I only have 1 filed called [name]. It can be [firstname] [lastname], [lastname] [firstname], [firstname] [second name] [lastname] etc..

That's just my approach. The main problem is that name field. If theres a way to do a wildcard search just for the name and and exact match for street, zip and town I'd be more than happy to do it in 1 step.

Thank you for your input.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Cross posted https://www.excelforum.com/excel-fo...ind-results-in-search-result.html#post4979410

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
So this is what I've got so far:
1) I created a search column for each sheet I need to compare
It looks like this: STREET$$ZIP$$TOWN
and the other: STREET$$ZIP$$TOWN//Value1$$Value2

2)I've got this in VBA

But now I need to find out how to filter the results one more time and get those Value1 and Value2

Code:
Sheets("Sheet2").Selectj = 0
Application.ScreenUpdating = False


    Dim stNow As Date
    stNow = Now


    Dim arr As Variant
    Dim varr As Variant
    
    arr = Sheets(1).Range("I2:I" & Sheets(1).Range("A" & Rows.Count).End(xlUp).Row).Value
    varr = Sheets(2).Range("S2:S" & Sheets(2).Range("A" & Rows.Count).End(xlUp).Row).Value


    Dim x, y, match As Boolean
    For Each x In arr
        
        x = Split(x, "//")
        match = False
        
        For Each y In varr
        
        If x(0) = y Then match = True
            j = j + 1
        Next y
        
        If match Then
           If x(0) <> "$$" Then
           
          
          Debug.Print x(0)
          
       
           
           End If
           
           


        End If
    Next


    
    Debug.Print Chr(13) & "-->" & DateDiff("s", stNow, Now) & " sec"


Application.ScreenUpdating = True
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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