Solved

Excel - script required to delete names

Posted on 2016-09-04
4
39 Views
Last Modified: 2016-09-04
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
Comment
Question by:gregfthompson
  • 2
  • 2
4 Comments
 

Author Comment

by:gregfthompson
ID: 41783435
the script needs capacity for perhaps several hundred names.
0
 
LVL 30

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 500 total points
ID: 41783446
Please try this.....
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

Open in new window

And use it like this....
In C2
=DeleteNames(A2)

Open in new window

and copy down.

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

Author Closing Comment

by:gregfthompson
ID: 41783586
Excellent work. Thank you.
0
 
LVL 30

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41783588
You're welcome. Glad to help.
Thanks for the feedback.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question