Using LibreOfficeCalc a spreadsheet alternative Married name and maiden name

edscollects

New Member
Joined
Feb 8, 2023
Messages
44
Office Version
  1. 2021
Platform
  1. Windows
I had this same question in excel and was never able to get a full answer. I want to compare 2 cells, the first has the name Joyce Thompson and the name Joyce Miller. This is the same person the first name is their maiden name and the second name is their married name. If someone could provide instruction in any spreadsheet program I would greatly appreciate it.
 
You will need to be more specific what you are looking for. Presently it reads "I have a single with two names in it and I want to compare those two names against each other."
Why would you want to do that ?
 
Upvote 0
You will need to be more specific what you are looking for. Presently it reads "I have a single with two names in it and I want to compare those two names against each other."
Why would you want to do that ?
I have a listing of 20 names compared to another listing of 20 names. I want to highlight the differences. However there are some names that a marriage took place so they were originally Pam Williams and are now listed as Pam Jordan. These would not be considered a difference as it is the same person.
 
Upvote 0
How can you tell if the person has a married name ?
 
Upvote 0
And there will NEVER be an exception to that rule ?
 
Upvote 0
Try the following :

VBA Code:
Sub CompareNames()
    Dim ws As Worksheet
    Dim lastRow As Long
    Dim i As Long
    Dim nameA As Variant
    Dim nameB As Variant
    
    ' Set the worksheet to the active sheet
    Set ws = ActiveSheet
    
    ' Find the last row with data in Column A
    lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
    
    ' Loop through each row
    For i = 1 To lastRow
        ' Split the names in Column A and Column B into arrays
        nameA = Split(ws.Cells(i, 1).Value, " ")
        nameB = Split(ws.Cells(i, 2).Value, " ")
        
        ' Compare first names
        If nameA(0) <> nameB(0) Then
            ' Compare full names
            If ws.Cells(i, 1).Value <> ws.Cells(i, 2).Value Then
                ' Place an "X" in Column C
                ws.Cells(i, 3).Value = "X"
            End If
        End If
    Next i
End Sub

The above macro assumes you are using cols A & B for both names. An "X" will be placed in column C for those names that don't match.
 
Upvote 0
Try the following :

VBA Code:
Sub CompareNames()
    Dim ws As Worksheet
    Dim lastRow As Long
    Dim i As Long
    Dim nameA As Variant
    Dim nameB As Variant
   
    ' Set the worksheet to the active sheet
    Set ws = ActiveSheet
   
    ' Find the last row with data in Column A
    lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
   
    ' Loop through each row
    For i = 1 To lastRow
        ' Split the names in Column A and Column B into arrays
        nameA = Split(ws.Cells(i, 1).Value, " ")
        nameB = Split(ws.Cells(i, 2).Value, " ")
       
        ' Compare first names
        If nameA(0) <> nameB(0) Then
            ' Compare full names
            If ws.Cells(i, 1).Value <> ws.Cells(i, 2).Value Then
                ' Place an "X" in Column C
                ws.Cells(i, 3).Value = "X"
            End If
        End If
    Next i
End Sub

The above macro assumes you are using cols A & B for both names. An "X" will be placed in column C for those names that don't match.
Thanks I will try it out.
 
Upvote 0
Ok so here is a picture of what I want. I have 2 cells of a row that may not be adjacent or a and b column. One reads Olney Central Junior College and the second is Olney College. They are the same school. I want to consider them as matches.
 
Upvote 0

Forum statistics

Threads
1,226,831
Messages
6,193,207
Members
453,779
Latest member
C_Rules

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