Automatic name change

bugalabuga

New Member
Joined
Jan 21, 2015
Messages
18
I get data from several sources everyday, and input the data into my workbook. Each data source has a list of names and with this list of names comes a common difference everyday. For example:

Site 1 data: Jim Beam
Site 2 data: Jim Beam Jr.
Site 3 data: Jim Beam Jr

This occurs with several names and the theme is common. What would be the best way to automatically change these names to a common name (such as Jim Beam Jr) so that all the names match up (as I pull data from each source which gets entered into separate sheets within the workbook and each sheet is referenced from the Master sheet)?

It would save me a great deal of time if I had something built in to automatically change these names...since I know which names I have to change everyday.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try this:

Code:
=LEFT(A1,FIND(" ",A1,FIND(" ",A1)+1)-1)

This will find seconf space in the string and extract only what's on the left of it - so just firstname & lastname. Is it OK for you?
 
Upvote 0
Try this:

Code:
=LEFT(A1,FIND(" ",A1,FIND(" ",A1)+1)-1)

This will find seconf space in the string and extract only what's on the left of it - so just firstname & lastname. Is it OK for you?

That would work for that situation, but the problem is I have other scenarios with names...such as:

Site 1 data: Bradley Smith
Site 2 data: Brad Smith

Site 1 data: John (James) Doe
Site 2 data: John Doe

I am trying to find a way to build in all the corrections I know will need to be made so I don't have to do it every day I load the data. Does that make sense?

Thank you for the suggestion...
 
Upvote 0
The only thing I can think of right now is to apply simple sub with all exceptions hardcoded in the code:

Code:
Sub T()

mCol = "A"

For i = 2 To Cells(Rows.Count, mCol).End(xlUp).Row
    If Cells(i, mCol) = "Bradley Smith" Then
        Cells(i, mCol) = "Brad Smith"
    ElseIf Cells(i, mCol) = "John (James) Doe" Then
        Cells(i, mCol) = "John Doe"
    'ElseIf...
    End If
Next i

End Sub

I assumed all your names are in column A and they start in row 2.
 
Upvote 0
The only thing I can think of right now is to apply simple sub with all exceptions hardcoded in the code:

Code:
Sub T()

mCol = "A"

For i = 2 To Cells(Rows.Count, mCol).End(xlUp).Row
    If Cells(i, mCol) = "Bradley Smith" Then
        Cells(i, mCol) = "Brad Smith"
    ElseIf Cells(i, mCol) = "John (James) Doe" Then
        Cells(i, mCol) = "John Doe"
    'ElseIf...
    End If
Next i

End Sub

I assumed all your names are in column A and they start in row 2.

It's more than just Column A, but I will give this a shot. This looks like a good long term solution.
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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