Remove all Numbers from list

Excel1991

Board Regular
Joined
Aug 1, 2018
Messages
58
Hi all,

I have a list in excel that looks similar to this:

[TABLE="width: 500"]
<tbody>[TR]
[TD]ROBBY[/TD]
[/TR]
[TR]
[TD]18205[/TD]
[/TR]
[TR]
[TD]19206[/TD]
[/TR]
[TR]
[TD]GEORGE[/TD]
[/TR]
[TR]
[TD]16573[/TD]
[/TR]
[TR]
[TD]ANDERSON[/TD]
[/TR]
[TR]
[TD]23456[/TD]
[/TR]
[TR]
[TD]26752[/TD]
[/TR]
[TR]
[TD]47658[/TD]
[/TR]
</tbody>[/TABLE]

I am trying to get the list so that it looks as follows:
[TABLE="width: 500"]
<tbody>[TR]
[TD]ROBBY[/TD]
[/TR]
[TR]
[TD]ROBBY[/TD]
[/TR]
[TR]
[TD]ROBBY[/TD]
[/TR]
[TR]
[TD]GEORGE[/TD]
[/TR]
[TR]
[TD]GEORGE[/TD]
[/TR]
[TR]
[TD]ANDERSON[/TD]
[/TR]
[TR]
[TD]ANDERSON[/TD]
[/TR]
[TR]
[TD]ANDERSON[/TD]
[/TR]
[TR]
[TD]ANDERSON[/TD]
[/TR]
</tbody>[/TABLE]

I was thinking I could try and remove all the numbers and then do a formula to fill the text down until it reaches the next filled cell. Anyone know how to do this or if there is an easier way? Thanks!
 
Last edited:

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
How about
Code:
Sub Excel1991()
    With Range("A2", Range("A" & Rows.Count).End(xlUp))
        .SpecialCells(xlConstants, xlNumbers).FormulaR1C1 = "=r[-1]c"
        .Value = .Value
    End With
End Sub
 
Upvote 0
This works great. Thank you.

There are a few numbers that I think may be stored as text as they were not filled (there are only a few so it is manageable), but I was wondering (for future possibly longer lists) what I would have to do to make sure they are converted as well? The "numbers" in my lists are codes and they are usually represented by 5 numeric digits. However, sometimes they may appear as "G0999" or "99999-25".
 
Upvote 0
Both of those are text, not numbers. Do any of the values you want to keep end with a number and do any of the values you want to remove end in anything other than a number?
 
Upvote 0
None of the values i wish to keep end in a number. Occasionally there may be a numeric code (which i am trying to remove) that has a trailing letter such as "99999R"
 
Upvote 0
In that case you need to come up with a rule that will identify those values you wish to remove, but will not affect the values you wish to remove.
So for instance will the 2nd character always be numeric?
 
Upvote 0
[TABLE="width: 500"]
<tbody>[TR]
[TD]ROBBY [/TD]
[/TR]
[TR]
[TD]99999[/TD]
[/TR]
[TR]
[TD]99999R[/TD]
[/TR]
[TR]
[TD]99999-25[/TD]
[/TR]
[TR]
[TD]G0459[/TD]
[/TR]
[TR]
[TD]GEORGE[/TD]
[/TR]
</tbody>[/TABLE]

Just to be more clear, I am trying to fill the name robby down until it hits "george" and then the pattern would continue. I am trying to ignore those codes in between if that is possible? The codes will always be one of these four variations.
 
Upvote 0
So is it safe to delete all values that have a number as the 2nd character?
 
Upvote 0
If the answer to the above question is yes, then try
Code:
Sub Excel1991()
    With Range("A2", Range("A" & Rows.Count).End(xlUp))
        .Value = Evaluate(Replace("if(isnumber(--mid(@,2,1)),"""",@)", "@", .Address))
        .SpecialCells(xlBlanks).FormulaR1C1 = "=r[-1]c"
        .Value = .Value
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top