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:

ROBBY
18205
19206
GEORGE
16573
ANDERSON
23456
26752
47658

<tbody>
</tbody>

I am trying to get the list so that it looks as follows:
ROBBY
ROBBY
ROBBY
GEORGE
GEORGE
ANDERSON
ANDERSON
ANDERSON
ANDERSON

<tbody>
</tbody>

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

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
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
ROBBY
99999
99999R
99999-25
G0459
GEORGE

<tbody>
</tbody>

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,214,651
Messages
6,120,739
Members
448,989
Latest member
mariah3

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