Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Seperate numbers from letters

I have a column within a list which is made up of numbers
and letters. Most of the time they are in blocks and I can
sepearte them using a custom function. However,
occassionally numbers are mixed with letters
e.g "And24this253". How can I seperate the numbers out of
this but keep the same order as they appear?

Thank you so much for your help.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Seperate numbers from letters

On Wed, 17 Dec 2003 08:33:08 -0800, "Jamal"
wrote:

I have a column within a list which is made up of numbers
and letters. Most of the time they are in blocks and I can
sepearte them using a custom function. However,
occassionally numbers are mixed with letters
e.g "And24this253". How can I seperate the numbers out of
this but keep the same order as they appear?

Thank you so much for your help.


Well, since this is a programming group, here are two UDF's to accomplish this:


================
Function GetValue(str)
Dim N As Integer, i As String
i = ""
For N = 1 To Len(str)
If IsNumeric(Mid(str, N, 1)) Then
i = i & Mid(str, N, 1)
If Mid(str, N + 1, 1) = "." Then i = i & "."
End If
Next
If i = "" Then
GetValue = i
Exit Function
End If
GetValue = CDbl(i)
End Function
'-----------------------
Function GetLtrs(str) As String

GetLtrs = ""

Dim N As Integer
For N = 1 To Len(str)
If Not (IsNumeric(Mid(str, N, 1))) Then GetLtrs = GetLtrs & Mid(str, N,
1)
Next
End Function
=============================


--ron
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
Custom Formating Letters to Numbers while Displaying Letters Luke Androsiglio Excel Worksheet Functions 2 March 31st 10 06:29 PM
Columns now numbers rather than letters how do i get letters back SalExcel10 Excel Discussion (Misc queries) 2 March 4th 10 02:48 PM
Count only Letters in cells that contain both letters and numbers TommyB Excel Worksheet Functions 2 August 8th 09 12:29 AM
How do I seperate numbers? AJSloss Excel Discussion (Misc queries) 5 February 7th 09 10:02 PM
create self-generating numbers with letters and numbers cxlough41 Excel Discussion (Misc queries) 11 January 4th 06 01:16 AM


All times are GMT +1. The time now is 07:44 AM.

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"