Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel - script required to delete names

Posted on 2016-09-04
4
Medium Priority
?
53 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 33

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 2000 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 33

Expert Comment

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

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

916 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