If Information Matches Other Spreadsheet

richmcgill

Board Regular
Joined
Feb 4, 2019
Messages
86
Office Version
  1. 2016
Platform
  1. Windows
I have two spreadsheets..
Spreadsheet 1 Take Loan number column A and Social Security Number Column D.
Spreadsheet 2 Match to the loan number from spreadsheet 1 and search the row for a match to the Social Security Number on Spreadsheet 1. This goes beyond a VLOOKUP.
On spreadsheet 1 (Yes or No works) based on a match of loan number and the social security number (there are nine social security numbers on the other spreadsheet) from spreadsheet 2.

Report Number 1
Loan NumberFirst NameLast NameSocial Security Number
88888JohnJones111111111
55555MaryWebb222222222
66666TomLuck333333333
77777HarrySmith444444444
11111JillMaxwell555555555
22222KyleComings666666666
33333FrankKilgore777777777

If you notice there are nine cells with Social Security Numbers so I do not think a VLOOKUP would work here.
Report Number 1
Loan NumberFirst NameLast NameSocial Security NumberSocial Security NumberSocial Security NumberSocial Security NumberSocial Security NumberSocial Security NumberSocial Security NumberSocial Security NumberSocial Security NumberSocial Security Number
88888JohnJones
55555MaryWebb
66666TomLuck
77777HarrySmith
11111JillMaxwell
22222KyleCummings
33333FrankKilgore
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Can you provide an example of what the desired output would be?
 
Upvote 0
Something like this. I do not need to know what column it is in just if it is present or not by a Yes or No or a Match or No Match.
Report Number 1
Loan NumberFirst NameLast NameSocial Security NumberMatch?
88888JohnJones111111111Match8th Column over
55555MaryWebb222222222Match12th Column Over
66666TomLuck333333333Match5th Column Over
77777HarrySmith444444444Match4th Column Over
11111JillMaxwell555555555No MatchSocial Security Number is not present
22222KyleComings666666666No MatchSocial Security Number is not present
33333FrankKilgore777777777Match7th Column Over


Loan NumberFirst NameLast NameSocial Security NumberSocial Security NumberSocial Security NumberSocial Security NumberSocial Security NumberSocial Security NumberSocial Security NumberSocial Security NumberSocial Security NumberSocial Security Number
88888JohnJones123456789465464684115481616478464694611111111156446457646544986464864684644684648546844
55555MaryWebb3341684861688764649849813688646846164864116666164695486946151646122222222246894864
66666TomLuck684864788333333333687681613163487981234658764536874633434736843543641348464898445468466
77777HarrySmith4444444446737344877066966541345493687821710957723463310662333787658363302879069063703741705
11111JillMaxwell13417116299901801741344528454673195639189150560571053430410003205256922832541141495825702315307
22222KyleCummings1101291285133058132813635434952002340528147855779813803101511319180628131521014315359159041360588546
33333FrankKilgore199855847016470270152001375295777777777254835244613673811451657167366134913009517983426661359162148
 
Upvote 0
You mentioned 9 cells with SS#s, you are showing 10 cells?

Is vba code an option?
 
Upvote 0
@richmcgill How about this:

VBA Code:
Sub ArrayTestV2()
'
'   Variable Names
    Dim CheckForMatchLastRow                            As Long
    Dim CheckForMatchLoanNumberSearchCounter            As Long
    Dim SourceLoanNumberSearchCounter                   As Long
    Dim SourceLastRow                                   As Long
    Dim SourceRowOffset                                 As Long
    Dim TotalColumnsInCheckForMatchSocialNumberArray    As Long
    Dim TotalRowsInCheckForMatchSocialNumberArray       As Long
    Dim CheckForMatchSocialNumberSearchCounter          As Long
'
'   Sheet Names
    Dim CheckForMatchSheet                              As String
    Dim SourceSheet                                     As String
'
    Dim MatchIndicatorColumn                            As String
'
'   Array Names
    Dim CheckForMatchLoanNumberArray()                  As Variant
    Dim CheckForMatchSocialNumberArray()                As Variant
    Dim SourceLoanNumberArray()                         As Variant
    Dim SourceSocialNumberArray()                       As Variant
'
    CheckForMatchSheet = "Sheet2"                                                                           ' <--- Set this to correct sheet name
    SourceSheet = "Sheet1"                                                                                  ' <--- Set this to correct sheet name
    SourceRowOffset = 2                                                                                     ' <--- Set this to correct offset to start of data
    MatchIndicatorColumn = "E"                                                                              ' <--- Set this to column for Match results
'
    CheckForMatchLastRow = Sheets(CheckForMatchSheet).Range("A" & Rows.Count).End(xlUp).Row                 ' Find Last row of CheckForMatch sheet
    SourceLastRow = Sheets(SourceSheet).Range("A" & Rows.Count).End(xlUp).Row                               ' Find Last row of Source sheet
'
    CheckForMatchLoanNumberArray = Sheets(CheckForMatchSheet).Range("A2:A" & CheckForMatchLastRow).Value2   ' Establish CheckForMatchLoanNumberArray
    CheckForMatchSocialNumberArray = Sheets(CheckForMatchSheet).Range("D2:L" & CheckForMatchLastRow).Value2 ' Establish CheckForMatchSocialNumberArray
    SourceLoanNumberArray = Sheets(SourceSheet).Range("A3:A" & SourceLastRow).Value2                        ' Establish SourceLoanNumberArray
    SourceSocialNumberArray = Sheets(SourceSheet).Range("D3:D" & SourceLastRow).Value2                      ' Establish SourceSocialNumberArray
'
    TotalRowsInCheckForMatchSocialNumberArray = UBound(CheckForMatchSocialNumberArray, 1) - LBound(CheckForMatchSocialNumberArray, 1) + 1   ' Number of rows in SS array
    TotalColumnsInCheckForMatchSocialNumberArray = UBound(CheckForMatchSocialNumberArray, 2) - LBound(CheckForMatchSocialNumberArray, 2) + 1 '  Number of columns in SS array
'
'   At this point all values needed are loaded into arrays, Sheet Names & variables
'
    For SourceLoanNumberSearchCounter = 1 To UBound(SourceLoanNumberArray)                                  ' Source Loan number loop
        For CheckForMatchLoanNumberSearchCounter = 1 To UBound(CheckForMatchLoanNumberArray)                ' Check for Match Loan number loop
            If CheckForMatchLoanNumberArray(CheckForMatchLoanNumberSearchCounter, 1) = SourceLoanNumberArray(SourceLoanNumberSearchCounter, 1) Then ' If Match found then ...
                For CheckForMatchSocialNumberSearchCounter = 1 To TotalColumnsInCheckForMatchSocialNumberArray  ' Check for Match Social number loop
                    If CheckForMatchSocialNumberArray(CheckForMatchLoanNumberSearchCounter, CheckForMatchSocialNumberSearchCounter) = _
                                SourceSocialNumberArray(SourceLoanNumberSearchCounter, 1) Then                      ' If Social number matches then ...
                        Sheets(SourceSheet).Range("E" & SourceLoanNumberSearchCounter + SourceRowOffset) = "Match"  '   Indicate Match was found
                    End If
                Next
            End If
        Next
    Next
    Sheets(SourceSheet).Range(MatchIndicatorColumn & 1 + SourceRowOffset & ":" & MatchIndicatorColumn & _
            SourceLastRow).SpecialCells(xlCellTypeBlanks).Value = "No Match"                    ' Identify any remaining blank cells in match column as "No Match"
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,275
Messages
6,171,122
Members
452,381
Latest member
Nova88

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