Deleting all data in cell if value starts with 3 particular letter

M

Mary Ann

I have a very large list of data which includes a column containing codes.
The codes might be just numbers or they could have letters in them as well.
If the code for the particular item starts with, let’s say, ASD I want to
delete all the data in the cell.

How do I achieve this?

I am a sophisticated user of Excel but do not do programming
 
G

Gary''s Student

Select your cells and run:

Sub cleaner()
For Each r In Selection
If Application.WorksheetFunction.IsText(r.Value) Then
If Left(r.Value, 3) = "ASD" Then
r.Value = ""
End If
End If
Next
End Sub
 
L

Lori

Try Edit > Replace with Find: ASD*
Leave replace box blank and in Options, check Match Entire Cell Contents.
 
Z

zxiqlpixs

Depending on the size of the list, you could apply a filter, then select
custom, then sort by Begins with and type in ASD.

Then, all the cells starting with ASD would show up, and you could select
them all, and delete them. If its a long list, a quick way of doing that
would be, highlight the first in the list, press buttons Ctrl+Shift+ Down
Arrow. That will take you to the bottom of the list.
 
M

Mary Ann

Thanks for your reply. My experience was Find/Replace did not recognise the
* wildcard. I'm using one of the other solutions - with the Autofilter.
 
M

Mary Ann

Thanks for the reply - I don't do programming so am going with another of the
solutions offered.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top