PC Review


Reply
Thread Tools Rate Thread

Copy of just numerical values within strings

 
 
BusyProfessorFromBremen
Guest
Posts: n/a
 
      15th Jun 2009
Hey @ all,

as I elaborated on a table I was revealing an issue by handling one column.
In this column there are values prevalent which aren't in a proper format.
They contain both numerical as well as alphanumerical values. Thus I would
like to copy just the numerical values out of these boxes. From there on I
can observe the information more in detail than I can do now. To simplify the
problem I give a brief example:

State of the art:

ID VALUE

123 45-32HH
123 22-33
321 24-1235GL
321 49-33HH

It should look like:

ID VALUE VALUENEW

123 J45-32HH 45-32
123 D22-33 22-33
321 24-1235GL 24-1235
321 49-33HH 49-33

Would be great if anybody has got a clou how to solve this problem.Thank you
very much in advance!

malte
 
Reply With Quote
 
 
 
 
Daniel Pineault
Guest
Posts: n/a
 
      15th Jun 2009
You'd have to use a custom function like:

Public Function StripAllChars(strString As String) As String
'Return only numeric values from a string
Dim lngCtr As Long
Dim intChar As Integer

For lngCtr = 1 To Len(strString)
intChar = Asc(Mid(strString, lngCtr, 1))
If intChar >= 48 And intChar <= 57 Then
StripAllChars = StripAllChars & Chr(intChar)
End If
Next lngCtr
End Function

You'll need to add a check/exception for the '-' as you want to keep that
character. Or you could use it as is and then perform an update to add it
back in since it seem to always be the 3rd character in the sequence.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.



"BusyProfessorFromBremen" wrote:

> Hey @ all,
>
> as I elaborated on a table I was revealing an issue by handling one column.
> In this column there are values prevalent which aren't in a proper format.
> They contain both numerical as well as alphanumerical values. Thus I would
> like to copy just the numerical values out of these boxes. From there on I
> can observe the information more in detail than I can do now. To simplify the
> problem I give a brief example:
>
> State of the art:
>
> ID VALUE
>
> 123 45-32HH
> 123 22-33
> 321 24-1235GL
> 321 49-33HH
>
> It should look like:
>
> ID VALUE VALUENEW
>
> 123 J45-32HH 45-32
> 123 D22-33 22-33
> 321 24-1235GL 24-1235
> 321 49-33HH 49-33
>
> Would be great if anybody has got a clou how to solve this problem.Thank you
> very much in advance!
>
> malte

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Only chart numerical values, not error values =?Utf-8?B?YW5keQ==?= Microsoft Excel Charting 2 8th Nov 2007 10:46 PM
Adding numerical values based on multiple values in another column =?Utf-8?B?S2F6bWFuaWFj?= Microsoft Excel Worksheet Functions 6 4th Apr 2007 08:53 PM
Sorting Numerical Values... =?Utf-8?B?U21vaHJtYW4=?= Microsoft Excel Worksheet Functions 9 7th Apr 2006 07:58 AM
Numerical values only saziz Microsoft Excel Misc 4 17th Mar 2006 12:50 AM
Associated Numerical Values =?Utf-8?B?a2RvZ2dpdHk=?= Microsoft Excel Misc 3 24th Feb 2006 07:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:23 AM.