Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Excel - script required to delete names

Posted on 2016-09-04
Medium Priority
47 Views
I  need to regularly update an address file, and part of the job is to remove building names within the address.
I'd like to be able to add the names to a script, that when it is run, it will delete the names from the list.
The attached file shows an example of the original list, and the required list.
EXAMPLE-FILE.xlsx
0
Question by:gregfthompson
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2
• 2

Author Comment

ID: 41783435
the script needs capacity for perhaps several hundred names.
0

LVL 32

Accepted Solution

Subodh Tiwari (Neeraj) earned 2000 total points
ID: 41783446
Function DeleteNames(str As String) As String
Dim i As Long
For i = 1 To Len(str)
If IsNumeric(Mid(str, i, 1)) And Mid(str, i + 1, 1) = " " Then
DeleteNames = Left(str, i + 1)
Exit For
End If
Next i
End Function
And use it like this....
In C2
=DeleteNames(A2)
and copy down.

For details, refer to the attached.
EXAMPLE-FILE.xlsm
0

Author Closing Comment

ID: 41783586
Excellent work. Thank you.
0

LVL 32

Expert Comment

ID: 41783588
Thanks for the feedback.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabilâ€¦
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
###### Suggested Courses
Course of the Month7 days, 12 hours left to enroll