Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default Removing Text from Alphanumeric values

Hi
I have a column containing alphanumeric values e.g.
HG06100
H134679
HC134679
HG05534
A434340
I need a formula or macro help to remove all the text values in the cell and
leave all the numbers behind including zero. Could someone please help, thanks

Syed
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Removing Text from Alphanumeric values

Check your other post.

Syed Rizvi wrote:

Hi
I have a column containing alphanumeric values e.g.
HG06100
H134679
HC134679
HG05534
A434340
I need a formula or macro help to remove all the text values in the cell and
leave all the numbers behind including zero. Could someone please help, thanks

Syed


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Removing Text from Alphanumeric values

Try this UDF:

Function numit(r As Range) As Double
Dim s As String, s2 As String, c As String
s2 = ""
s = r.Value
l = Len(s)
For i = 1 To l
c = Mid(s, i, 1)
If c Like "#" Then
s2 = s2 & c
End If
Next
numit = --s2
End Function

--
Gary''s Student - gsnu200778


"Syed Rizvi" wrote:

Hi
I have a column containing alphanumeric values e.g.
HG06100
H134679
HC134679
HG05534
A434340
I need a formula or macro help to remove all the text values in the cell and
leave all the numbers behind including zero. Could someone please help, thanks

Syed

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Removing Text from Alphanumeric values

If, as all your examples show, the non-digits are always in front of the
digits, you can use this formula...

=MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456 789")),255)

The 255 in the above formula assumes your values are never longer than 255
characters; you can lower this number to a value equal to or greater than
the length of the longest alphanumeric value you will ever process.

Rick


"Syed Rizvi" wrote in message
...
Hi
I have a column containing alphanumeric values e.g.
HG06100
H134679
HC134679
HG05534
A434340
I need a formula or macro help to remove all the text values in the cell
and
leave all the numbers behind including zero. Could someone please help,
thanks

Syed


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default Removing Text from Alphanumeric values

I am not familiar how to define this Excel, could you please give me some
more instructions how to use this code please.
many thanks

Syed

"Gary''s Student" wrote:

Try this UDF:

Function numit(r As Range) As Double
Dim s As String, s2 As String, c As String
s2 = ""
s = r.Value
l = Len(s)
For i = 1 To l
c = Mid(s, i, 1)
If c Like "#" Then
s2 = s2 & c
End If
Next
numit = --s2
End Function

--
Gary''s Student - gsnu200778


"Syed Rizvi" wrote:

Hi
I have a column containing alphanumeric values e.g.
HG06100
H134679
HC134679
HG05534
A434340
I need a formula or macro help to remove all the text values in the cell and
leave all the numbers behind including zero. Could someone please help, thanks

Syed



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default Removing Text from Alphanumeric values

Thanks very much folks, much appreciated

"Rick Rothstein (MVP - VB)" wrote:

If, as all your examples show, the non-digits are always in front of the
digits, you can use this formula...

=MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456 789")),255)

The 255 in the above formula assumes your values are never longer than 255
characters; you can lower this number to a value equal to or greater than
the length of the longest alphanumeric value you will ever process.

Rick


"Syed Rizvi" wrote in message
...
Hi
I have a column containing alphanumeric values e.g.
HG06100
H134679
HC134679
HG05534
A434340
I need a formula or macro help to remove all the text values in the cell
and
leave all the numbers behind including zero. Could someone please help,
thanks

Syed



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Removing Text from Alphanumeric values

A UDF is a way to create your own function and use it in the worksheet just
like SUM, AVERAGE, MIN, MAX, etc. UDFs are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the UDF will be saved with it.

To use the UDF from the normal Excel window, just enter it like a normal
Excel function:

=numit(A1)

To remove the UDF:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To learn more about UDFs, see:

http://www.cpearson.com/excel/Writin...ionsInVBA.aspx

--
Gary''s Student - gsnu200778


"Syed Rizvi" wrote:

I am not familiar how to define this Excel, could you please give me some
more instructions how to use this code please.
many thanks

Syed

"Gary''s Student" wrote:

Try this UDF:

Function numit(r As Range) As Double
Dim s As String, s2 As String, c As String
s2 = ""
s = r.Value
l = Len(s)
For i = 1 To l
c = Mid(s, i, 1)
If c Like "#" Then
s2 = s2 & c
End If
Next
numit = --s2
End Function

--
Gary''s Student - gsnu200778


"Syed Rizvi" wrote:

Hi
I have a column containing alphanumeric values e.g.
HG06100
H134679
HC134679
HG05534
A434340
I need a formula or macro help to remove all the text values in the cell and
leave all the numbers behind including zero. Could someone please help, thanks

Syed

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I seperate text and number from alphanumeric cell? Jennifer Medina Excel Worksheet Functions 3 November 15th 07 11:27 PM
VLOOKUP with numeric and alphanumeric values Dan Excel Discussion (Misc queries) 6 November 2nd 07 04:59 PM
Need to test for alphanumeric value and write numeric values to ce Pyramid 36 Excel Worksheet Functions 3 August 3rd 07 03:15 AM
Generate alphanumeric unique 4 digit values from 12 digit values mikep Excel Worksheet Functions 5 February 9th 07 08:59 PM
how do i enter alphanumeric values? ECY Excel Discussion (Misc queries) 1 January 20th 06 08:46 PM


All times are GMT +1. The time now is 02:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"