Solved

Excel - script required to delete names

Posted on 2016-09-04
4
41 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
[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
  • Learn & ask questions
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
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.

756 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