Solved

Excel - script required to delete names

Posted on 2016-09-04
4
44 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 31

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 31

Expert Comment

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

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

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.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

623 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