A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Discussion (Misc queries)
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Remove Numbers from Alphanumeric String



 
 
Thread Tools Display Modes
  #1  
Old October 26th 07, 07:03 PM posted to microsoft.public.excel.misc
Dave
external usenet poster
 
Posts: 1,389
Default Remove Numbers from Alphanumeric String

Hi,

I have a value in Cell A of ABC123.

I want Cell B1 to contain the 123 from this cell.

Can anyone tell me the formula to enter in B1. I'm sure I've seen it
somewhere before but can't put my finger on it.

Thanks!
Dave
Ads
  #2  
Old October 26th 07, 07:19 PM posted to microsoft.public.excel.misc
Bob Umlas[_2_]
external usenet poster
 
Posts: 68
Default Remove Numbers from Alphanumeric String

if it's always the 4th position, then =mid(A1,4,255). If you want it to be
numeric, then =1*mid(a1,4,255).
If the position is unknown but is always letters followed by numbers,
ctrl+shift+enter this:

=1*MID(A1,MATCH(FALSE,ISERROR(1*MID(A1,ROW($1:$20) ,1)),0),255)

Bob Umlas
Excel MVP

"Dave" > wrote in message
...
> Hi,
>
> I have a value in Cell A of ABC123.
>
> I want Cell B1 to contain the 123 from this cell.
>
> Can anyone tell me the formula to enter in B1. I'm sure I've seen it
> somewhere before but can't put my finger on it.
>
> Thanks!
> Dave


  #3  
Old October 26th 07, 07:23 PM posted to microsoft.public.excel.misc
Farhad
external usenet poster
 
Posts: 281
Default Remove Numbers from Alphanumeric String

Hi,

Try this:

=RIGHT(A1,3)

Thanks,
--
Farhad Hodjat


"Dave" wrote:

> Hi,
>
> I have a value in Cell A of ABC123.
>
> I want Cell B1 to contain the 123 from this cell.
>
> Can anyone tell me the formula to enter in B1. I'm sure I've seen it
> somewhere before but can't put my finger on it.
>
> Thanks!
> Dave

  #4  
Old October 26th 07, 07:27 PM posted to microsoft.public.excel.misc
Gary''s Student
external usenet poster
 
Posts: 11,058
Default Remove Numbers from Alphanumeric String

Try this UDF:

Function letteronly(r As Range) As String
letteronly = ""
If Application.WorksheetFunction.IsText(r.Value) Then
s = r.Value
For i = 49 To 57
s = Replace(s, Chr(i), "")
Next i
letteronly = s
End If
End Function
--
Gary''s Student - gsnu200751


"Dave" wrote:

> Hi,
>
> I have a value in Cell A of ABC123.
>
> I want Cell B1 to contain the 123 from this cell.
>
> Can anyone tell me the formula to enter in B1. I'm sure I've seen it
> somewhere before but can't put my finger on it.
>
> Thanks!
> Dave

  #5  
Old October 26th 07, 07:44 PM posted to microsoft.public.excel.misc
www.exciter.gr www.exciter.gr is offline
Banned
 
First recorded activity by ExcelBanter: Oct 2007
Posts: 4
Default Remove Numbers from Alphanumeric String

You can try this Custom Function. Copy the code into the VBA window of
your file and then go to cell B1 and type =RemoveTexts(A1)

This function checks each character of your target cell and keeps only
numeric characters. Before returning the number, it actually converts
it to numeric (so 123 will be number, not text). For empty or text-
only cells, it will return zero.

Public Function RemoveTexts(Target As Range)
Dim t As String
For i = 1 To Len(Target.Value)
t = Mid(Target.Value, i, 1)
If IsNumeric(t) = True Then
RemoveTexts = RemoveTexts & t
End If
Next i
RemoveTexts = Val(RemoveTexts)
End Function





On Oct 26, 9:03 pm, Dave > wrote:
> Hi,
>
> I have a value in Cell A of ABC123.
>
> I want Cell B1 to contain the 123 from this cell.
>
> Can anyone tell me the formula to enter in B1. I'm sure I've seen it
> somewhere before but can't put my finger on it.
>
> Thanks!
> Dave



  #6  
Old October 28th 07, 05:01 PM posted to microsoft.public.excel.misc
Dave
external usenet poster
 
Posts: 1,389
Default Remove Numbers from Alphanumeric String

Thanks Farhad. This works, but my string does not always have 3 digits. Some
are 4 or 5 digits.

"Farhad" wrote:

> Hi,
>
> Try this:
>
> =RIGHT(A1,3)
>
> Thanks,
> --
> Farhad Hodjat
>
>
> "Dave" wrote:
>
> > Hi,
> >
> > I have a value in Cell A of ABC123.
> >
> > I want Cell B1 to contain the 123 from this cell.
> >
> > Can anyone tell me the formula to enter in B1. I'm sure I've seen it
> > somewhere before but can't put my finger on it.
> >
> > Thanks!
> > Dave

  #7  
Old October 28th 07, 05:03 PM posted to microsoft.public.excel.misc
Dave
external usenet poster
 
Posts: 1,389
Default Remove Numbers from Alphanumeric String

This returns #N/A

"Bob Umlas" wrote:

> if it's always the 4th position, then =mid(A1,4,255). If you want it to be
> numeric, then =1*mid(a1,4,255).
> If the position is unknown but is always letters followed by numbers,
> ctrl+shift+enter this:
>
> =1*MID(A1,MATCH(FALSE,ISERROR(1*MID(A1,ROW($1:$20) ,1)),0),255)
>
> Bob Umlas
> Excel MVP
>
> "Dave" > wrote in message
> ...
> > Hi,
> >
> > I have a value in Cell A of ABC123.
> >
> > I want Cell B1 to contain the 123 from this cell.
> >
> > Can anyone tell me the formula to enter in B1. I'm sure I've seen it
> > somewhere before but can't put my finger on it.
> >
> > Thanks!
> > Dave

>

  #8  
Old October 28th 07, 05:04 PM posted to microsoft.public.excel.misc
Dave
external usenet poster
 
Posts: 1,389
Default Remove Numbers from Alphanumeric String

Hi GarysStudent. Can you explain how to use this? Thanks!

"Gary''s Student" wrote:

> Try this UDF:
>
> Function letteronly(r As Range) As String
> letteronly = ""
> If Application.WorksheetFunction.IsText(r.Value) Then
> s = r.Value
> For i = 49 To 57
> s = Replace(s, Chr(i), "")
> Next i
> letteronly = s
> End If
> End Function
> --
> Gary''s Student - gsnu200751
>
>
> "Dave" wrote:
>
> > Hi,
> >
> > I have a value in Cell A of ABC123.
> >
> > I want Cell B1 to contain the 123 from this cell.
> >
> > Can anyone tell me the formula to enter in B1. I'm sure I've seen it
> > somewhere before but can't put my finger on it.
> >
> > Thanks!
> > Dave

  #9  
Old October 28th 07, 05:04 PM posted to microsoft.public.excel.misc
Dave
external usenet poster
 
Posts: 1,389
Default Remove Numbers from Alphanumeric String

This doesn't seem to work.

"www.exciter.gr" wrote:

> You can try this Custom Function. Copy the code into the VBA window of
> your file and then go to cell B1 and type =RemoveTexts(A1)
>
> This function checks each character of your target cell and keeps only
> numeric characters. Before returning the number, it actually converts
> it to numeric (so 123 will be number, not text). For empty or text-
> only cells, it will return zero.
>
> Public Function RemoveTexts(Target As Range)
> Dim t As String
> For i = 1 To Len(Target.Value)
> t = Mid(Target.Value, i, 1)
> If IsNumeric(t) = True Then
> RemoveTexts = RemoveTexts & t
> End If
> Next i
> RemoveTexts = Val(RemoveTexts)
> End Function
>
>
>
>
>
> On Oct 26, 9:03 pm, Dave > wrote:
> > Hi,
> >
> > I have a value in Cell A of ABC123.
> >
> > I want Cell B1 to contain the 123 from this cell.
> >
> > Can anyone tell me the formula to enter in B1. I'm sure I've seen it
> > somewhere before but can't put my finger on it.
> >
> > Thanks!
> > Dave

>
>
>

  #10  
Old October 28th 07, 05:23 PM posted to microsoft.public.excel.misc
RagDyeR
external usenet poster
 
Posts: 3,572
Default Remove Numbers from Alphanumeric String

Probably because you *didn't* enter it the proper way.
It's an *array* formula!
--
Array formulas must be entered with CSE, <Ctrl> <Shift > <Enter>, instead of
the regular <Enter>, which will *automatically* enclose the formula in curly
brackets, which *cannot* be done manually.
You *must also* use CSE when revising the formula.

You can click in the cell containing the formula.
Then click in the formula bar, hold down
<Ctrl> and <Shift>
Then hit <Enter>
--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"Dave" > wrote in message
...
> This returns #N/A
>
> "Bob Umlas" wrote:
>
> > if it's always the 4th position, then =mid(A1,4,255). If you want it to

be
> > numeric, then =1*mid(a1,4,255).
> > If the position is unknown but is always letters followed by numbers,
> > ctrl+shift+enter this:
> >
> > =1*MID(A1,MATCH(FALSE,ISERROR(1*MID(A1,ROW($1:$20) ,1)),0),255)
> >
> > Bob Umlas
> > Excel MVP
> >
> > "Dave" > wrote in message
> > ...
> > > Hi,
> > >
> > > I have a value in Cell A of ABC123.
> > >
> > > I want Cell B1 to contain the 123 from this cell.
> > >
> > > Can anyone tell me the formula to enter in B1. I'm sure I've seen it
> > > somewhere before but can't put my finger on it.
> > >
> > > Thanks!
> > > Dave

> >


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparison of alphanumeric string ErExcel Excel Discussion (Misc queries) 4 May 7th 07 02:14 PM
How to extract decimal numbers e.g. $1.57 from alphanumeric string Lio Excel Discussion (Misc queries) 8 December 12th 06 07:35 PM
How do I replace last numeric string from a alphanumeric string? Christy Excel Discussion (Misc queries) 3 August 11th 06 12:17 AM
Auto convert an alphanumeric string (CIS9638S) to numbers only? SDesmond Excel Worksheet Functions 0 September 7th 05 01:17 AM
Auto convert an alphanumeric string (CIS9638S) to numbers only? Gary L Brown Excel Worksheet Functions 1 September 7th 05 01:17 AM


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


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