Remove All Non Numeric Characters

Oct 16, 2007

The macro I have select 2 columns and 2000 rows. I need a VBA code that will loop through each of these 4000 cells and remove all characters (replace them with blanks) that are not a number, a period or a decimal. Characters from other languages like Chinese, Japanese and Russian should also be removed.

View 3 Replies


ADVERTISEMENT

Remove Non-alpha Characters From Alphanumerics With Option To Remove Numbers

Aug 8, 2009

I have found a very useful UDF for removing non-alpha characters from strings. (See below, Credit for posting to Stanley D Grom - Ozgrid post ´Removing Non-alpha Characters From Text´).

Option Explicit

Private Function RemoveCharacters(InString As String) As String
Dim intLoopCounter As Integer
Dim intStringLength As Integer
Dim intASCIIVal As Integer
intStringLength = Len(InString)
InString = LCase(InString)
For intLoopCounter = 1 To intStringLength
intASCIIVal = Asc(Mid(InString, intLoopCounter, 1))
If intASCIIVal >= 97 And intASCIIVal <= 122 Then
RemoveCharacters = RemoveCharacters + Mid(InString, intLoopCounter, 1)
End If
Next intLoopCounter
End Function

Two requests:

1. Could the UDF be modified such that any part of a string contained within brackets is also removed (e.g. "NLGA High Street (West-Enfield), EN6" becomes "nlgahighstreeten")?

2. Can an argument be added to the format of the UDF, such that numbers (0 to 9) are either included or excluded (e.g. RemoveCharacters(A1,1) where the argument ´1´ would include any numbers (0 to 9), so "NLGA2003 High Street (West-Enfield), EN6" becomes "nlga2003highstreeten6")? ´blank´or ´0´would exclude these numbers, i.e. would return "nlgahighstreeten"

View 5 Replies View Related

Getting Rid Of Every Non Numeric Characters

Jan 13, 2007

I have a cell that contains BYO CUSTOMER XYZ 76458992

I want the cell next to it to remove all of the letters and display only 76458992.

View 9 Replies View Related

Extract Numeric Characters

Jul 1, 2009

I have a column contains Postal Adress in more than 5000 rows. Column contains Door Number, Area, City and Zip code. I need to separate "Zip code" alone in next coulmn. Zip code (of India) will be in six digits like "600083" also some cases contain space in middle of zip code like "600 083" (after 3 digits). Is there any way to do this without doing cut & paste?

View 9 Replies View Related

Extract Set Of Numeric Characters

Jul 3, 2009

I have a column contains Telephone numbers with or without area code and country code for across the country (India). I need to extract the telephone numbers alone (neither area code nor country code). Telephone numbers will be 6 or 7 or 8 digits (not more than that). Is it possible to extract any set of numbers contain 6 or 7 or 8 digits continously? Some of the cases contains 2 contact numbers (2 set of 6 or 7 or 8 digit characters, between special characters will be there like slash, comma, space, hypen, etc.,

Here are some examples: ....

View 9 Replies View Related

Check If 1st X Characters Are Numeric

Aug 10, 2007

In my column of text strings, I have a multiple format of strings make-up. Below is just one of them I have to check that the first 6 are digits from 0 to 9, and it is followed by a hypen. If condition is true, the first 6 digits is the output (ie. 345678).

345678-S

=IF(ISNUMBER(--(MID(A1, FIND("-",A1)-1,1))--(MID(A1,FIND("-",A1)-2,1))--(MID(A1,FIND("-",A1)-3,1))--(MID(A1,FIND("-",A1)-4,1))--(MID(A1,FIND("-",A1)-5,1))--(MID(A1,FIND("-",A1)-6,1))),LEFT(A1,FIND("-",A1)-1))

However, if I were to continue doing this for other strings, I would soon run out of characters limit that is allowed in a cell. I wonder whether a formulae such as below is valid? Any suggestion or help for a shorter formula is very much appreciated.

=IF(ISNUMBER(--(LEFT(A1,1+1+1+1+1+1))),LEFT(A1,6))

View 4 Replies View Related

Trim Numeric Characters After The Decimal

Feb 24, 2009

I have something simple (i think) but i cant think it through. I have a range of cells that are populated by a link and so even though the value shows #,### It really shows #,###.########

I would like to trim everything after the decimal point without having to adjust format of the range since some cells are general format and others are Percentage format but they all suffer from .####### HOWEVER, the last digits are variable and never the exact same amount of characters.

for each cell in range("C4:J9")
if cell.value "" then
Trim(Left(cell,4))
end if
next cell

View 9 Replies View Related

Formula: Last X Characters, Text Or Numeric

Dec 7, 2006

I am trying to write a formula that will recgonise either text or numicial value as the result is used with a match formula. In column C I have data as follows:

1400 SBY
1230 9985
ADO

I am using a =--RIGHT(C4,4) formula in column E to get the required data and then using my match formula to extract other data. How can I rewrite the above formula so that it can read either text or numbers that will allow my match formula to work.

View 5 Replies View Related

Extract Numeric Value Based Upon Ending Characters

Jan 10, 2014

I have a list of numbers in which I need to return the last 5 digits; the length of the string may vary.

However, if the last two digits of the number ends in a specific value then it should skip over the last two numbers and return the preceding 5 digits.

I have tried and have used the very basic Left, Right and Mid functions. My problem is I dont know how to code the formula to identify the last two digits and skip over them, if necessary.

I have provided an attached example.

Extract numeric value based upon ending characters.xlsm

View 5 Replies View Related

Format Some Numeric Characters In Cell As Subscript

Feb 16, 2010

I thought I had this solved but an inconsistency has shown up. I have a long list of chemical formulas that I want to format (partially) as subscript.

Basically what I need the macro to do is look at each character within a cell and check to see if it is numeric. If it is AND it follows a non-numeric character it should be formatted as subscript.

Examples
H2O the 2 should be subscript
H2SO4 the 2 and the 4 should be subscript
2CCl4 only the 4 should be subscript

View 2 Replies View Related

Format Specified Numeric Characters In Cell As Subscript

Feb 16, 2010

I have a long list of chemical formulas that I want to format (partially) as subscript.

Basically what I need the macro to do is look at each character within a cell and check to see if it is numeric. If it is AND it follows a non-numeric character it should be formatted as subscript.

Examples
H2O the 2 should be subscript
H2SO4 the 2 and the 4 should be subscript
2CCl4 only the 4 should be subscript
CuSO4 - 5H2O

View 2 Replies View Related

Explanation For Formula That Counts Number Of Numeric Characters

Nov 21, 2012

The formula below was posted recently as a way to extract a numeric substring from somewhere in larger string. When I first saw this formula, how it "came up with the goods" and so I spent some time looking at parts of it to see what they did.

Although I've made some progress, I still don't fully understand it. Heres the formula, and below Ive detailed how far I've got:

=Iferror(lookup(9.99e+307,--mid(a1,min(find({1,2,3,4,5,6,7,8,9,0},a1&1234567890)),row(indirect("1:"&len(a1))))),0)

I hope my findings below are correct:

1. The formula is returning the first substring of contiguous numeric characters from the full string in Cell A1
2. 9.99e + 307 ensures that the search value won't be exceeded by the returned value.
3. The Mid function uses Min(Find( to get the character position of the first numeric in A1 (so MID then has its first 2 parameters). So far so good.
4. Now... I cant work out where MID parameter 3 (the substring length) comes from. I suspect its the row function, but can't see how as this isn't an array formula, and without CTRL+Shift+ Enter, I could only get Row to return 1 in my experiments (giving me only the first substring digit).

How does the formula return the correct number of numeric characters, (apparently) without counting them?

View 3 Replies View Related

Remove Row If Cell Is Numeric?

Feb 29, 2012

I am trying to delete a row if the cell value of column A is a number and not a name.

What i have been using to remove things is this.

Code:

Last = Cells(Rows.Count, "A").End(xlUp).Row
For G = Last To 1 Step -1
If (Cells(G, "A").Value) = "" Then

[Code].....

View 2 Replies View Related

Sort Values Which Has Numeric, Spaces And Capital Letter Characters

Oct 8, 2009

I would like to sort words or data which has the First capital letter, words which has spaces and words which contains number... i have attached a sample file.

View 9 Replies View Related

Remove All Numeric Data In A Cell

Jan 25, 2010

I have a data import from our client something like this:

a1:12/11/2009 shoe bags blank-** $700.00 $0.00 $3,949.00

How can i delete all the numeric data in the cell?

i need only the text: shoe bags blank-** in a2

View 3 Replies View Related

Remove Alphabet To Return Numeric

Aug 2, 2008

I need a formula to remove all alphabet in a cell,for instance:-
A1=130 sheets returns 130
A2=118pcs returns 118
A3=approx123 returns 123

View 4 Replies View Related

Remove Comma From Text To Numeric

Jan 13, 2010

I need a simple way to extract the comma in 14,656 imported text so I can do a vlookup against 14656.

View 9 Replies View Related

Remove All Non-numeric Data Out Of A String

May 24, 2006

I need to be able to take a string & remove all non numeric data. If I had "(123) 456-7890" I would want it to return "1234567890".

View 6 Replies View Related

Remove The First Digit From A Numeric And Replace With Remainder

May 2, 2006

I have a list of stock codes which are 6 digits long and there are over 550 of them.
We have shortened our codes to a five digit number, removing the first digit.
Is there a way to delete the first digit of the numeric and replace it with the remainder in all of the 550+ cells?

View 9 Replies View Related

Remove Certain Characters From A Row

Jun 5, 2008

let's say row 2 has data that looks like

apple (kg), apple (g), orange (kg), orange (g)

it is possible to remove the (kg) and (g) tags so that it'll become
apple, apple, orange, orange

using VB code?

View 9 Replies View Related

Remove Characters

Apr 27, 2006

May I know how to remove character like

1) full stop
2) spacing
3) Dash
4) Hyphen
5) Left and Right Slash

For example:-

016-2733(LS-800E)
MS12-FS4/2M
1/4"GTR

Output:
0162733LS800E
MS12FS42m
14GTR

View 2 Replies View Related

Remove Characters From Right Of String

Dec 26, 2009

I'm trying to remove everything after a specific character in a string.

I.e. change a website address to the hostname

http://www.excelforum.com/newthread.php
http://usa.excelforum.com/forum/new

to

excelforum.com
usa.excelforum.com

I'm using this formula, which strips the http:// and the www., but does not replace the characters after the first remaining "/" as the wildcard is not recognized.

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"www.",""), A2,"http://",""), A2, "/*", "")

View 11 Replies View Related

Maco That Will Remove Certain Characters

Feb 19, 2008

I have to manually go through about 9,000 workbooks. In cell E43 of a certain sheet called "list" I have to delete underscores(_) and replace them with a single space. and remove the Rev** after each name

In example: company_name_t45671000_RevA2

Will look like this when I'm done: company name t45671000

Now I've tried to make a Macro that will delete the underscores and the Rev which worked fine except that it replaced the names with the the name that the macro was recored under.

IE: The first sheet I done worked fine when I hit the keyboard shortcut command which was company_name_t45671000_RevA2.

The second workbook sheet of "list" got fixed but had the name of the one I fixed before it: company name t45671000, where it should have been "company name s6743245.

Is there a way around this?

Also sometimes the sheets are protected, is there a way to incorporate "unprotect sheet" when it needs to be unprotected and then after the file has been corrected, re-enable protection again?

View 11 Replies View Related

Remove Characters Before First Non-zero Number

Mar 6, 2013

I always seem to have trouble with the Find() and MID() function when used together. I try to following the syntax but it keeping erroring...

I'm trying to remove all the characters before the first non-zero number.

e.g. ABC263080 becomes 263080
PROGO0123 becomes 123

View 1 Replies View Related

How To Remove The Last X Characters In A Cell

Apr 3, 2008

I need to remove the last x characters if its equal to 0's

see:
101190
101200
101300
102000
102010
102020

should be

10119
1012
1013
102
10201
10202

View 9 Replies View Related

VBA To Remove Characters And Commas

May 26, 2009

i need a macro to do the following,

1. Remove all commas from activeworksheet ( i notice i cant see the commas in excel, but when i open notepad i have commas in empty rows)

2. Remove all characters such as = + # ( ) $ from Column 5

View 9 Replies View Related

Remove All Characters But The Numbers

Sep 10, 2009

there is a none VBA way to remove everything from a cell but the numbers.

Example: A, DAVID (002081) becomes 002081

The cell the formula will go in is F4 and the cell its looking at is K4.

View 9 Replies View Related

Remove Last X Characters From Cells

Feb 10, 2009

I need to remove the last 2 digits from a cell that maybe different lengths. For example:

PL26 7QS
ST20 0AW
LE4 8LF
PE30 3WH
CF31 3AY

View 3 Replies View Related

Remove Last Three Characters In A Cell

Jul 21, 2006

The numerical results in column A need to have the last three characters stripped from the cells. I used the =LEFT formula in adjacent cells to return the results but I am looking for a way to run code to remove these three numbers in each cell from row 1 to 8000 in column A.

View 2 Replies View Related

Remove Unwanted Characters

Nov 9, 2006

i want to convert an excel spreadsheet into a text file, keeping the same format, but when i do so, excel puts " " around the characters, which i don't want. Example: please see the 2 attachments.

e.g. when i convert, i don't want the " " around the commas in the text file.

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved