A Microsoft Office (Excel, Word) forum. OfficeFrustration

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 » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Help with MID Function?



 
 
Thread Tools Display Modes
  #1  
Old February 4th, 2009, 12:17 AM posted to microsoft.public.excel.worksheet.functions
KLZA
external usenet poster
 
Posts: 47
Default Help with MID Function?

Hi. I may not have explained myself well enough in my last post. So
here goes again.
I'm trying to capture / extract specific data within a string of text
in a cell. I need to capture a string of numeric characters plus only
the first alpha character immediately after the numbers. The numbers
of alpha characters varies before the numeric characters. So my cells
could look like this: TTTTT10TTTTTT or TTT1000TTTT or
TTTTTTT1TTTTTTTTTTTT etc.. My output from the cells would be 10T or
1000T or 1T etc... The text string before and after the number string
vary. Can this be done?



  #2  
Old February 4th, 2009, 12:35 AM posted to microsoft.public.excel.worksheet.functions
Rick Rothstein[_2_]
external usenet poster
 
Posts: 2,013
Default Help with MID Function?

Sure... just use the last formula I posted back in your first thread on this
problem; namely,

=MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456 789")),LEN(LOOKUP(9E+307,--LEFT(MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"012 3456789")),999),ROW(1:999))))+1)

Change all the A1 references (4 of them) to whatever cell you have your text
in. This formula can be copied down if necessary.

--
Rick (MVP - Excel)


"KLZA" wrote in message
...
Hi. I may not have explained myself well enough in my last post. So
here goes again.
I'm trying to capture / extract specific data within a string of text
in a cell. I need to capture a string of numeric characters plus only
the first alpha character immediately after the numbers. The numbers
of alpha characters varies before the numeric characters. So my cells
could look like this: TTTTT10TTTTTT or TTT1000TTTT or
TTTTTTT1TTTTTTTTTTTT etc.. My output from the cells would be 10T or
1000T or 1T etc... The text string before and after the number string
vary. Can this be done?




  #3  
Old February 4th, 2009, 02:01 AM posted to microsoft.public.excel.worksheet.functions
KLZA
external usenet poster
 
Posts: 47
Default Help with MID Function?

On Feb 3, 7:35*pm, "Rick Rothstein"
wrote:
Sure... just use the last formula I posted back in your first thread on this
problem; namely,

=MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456 789")),LEN(LOOKUP(9E+307,*--LEFT(MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"012 3456789")),999),ROW(1:9*99))))+1)

Change all the A1 references (4 of them) to whatever cell you have your text
in. This formula can be copied down if necessary.

--
Rick (MVP - Excel)

"KLZA" wrote in message

...



Hi. *I may not have explained myself well enough in my last post. *So
here goes again.
I'm trying to capture / extract specific data within a string of text
in a cell. *I need to capture a string of numeric characters plus only
the first alpha character immediately after the numbers. *The numbers
of alpha characters varies before the numeric characters. *So my cells
could look like this: *TTTTT10TTTTTT or TTT1000TTTT or
TTTTTTT1TTTTTTTTTTTT etc.. * My output from the cells would be 10T or
1000T or 1T etc... *The text string before and after the number string
vary. *Can this be done?- Hide quoted text -


- Show quoted text -


Hi. First, thanks for the help. The formula doesn't seem to work.
Can someone test it or explain what I'm possibly doing wrong?
  #4  
Old February 4th, 2009, 02:13 AM posted to microsoft.public.excel.worksheet.functions
Rick Rothstein[_2_]
external usenet poster
 
Posts: 2,013
Default Help with MID Function?

Can you describe what "doesn't seem to work" means? What do you see the
formula returning? Did you change the cell references (the A1's) to the cell
that has your text?

Try this experiment. Put one of your text strings in A1; then click in A3 to
activate it (really, any cell will do); and then copy/paste the formula I
posted (do not try to re-type it) into the Formula Bar. and hit Enter. What
is displayed in A3?

--
Rick (MVP - Excel)


"KLZA" wrote in message
...
On Feb 3, 7:35 pm, "Rick Rothstein"
wrote:
Sure... just use the last formula I posted back in your first thread on
this
problem; namely,

=MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456 789")),LEN(LOOKUP(9E+307,*--LEFT(MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"012 3456789")),999),ROW(1:9*99))))+1)

Change all the A1 references (4 of them) to whatever cell you have your
text
in. This formula can be copied down if necessary.

--
Rick (MVP - Excel)

"KLZA" wrote in message

...



Hi. I may not have explained myself well enough in my last post. So
here goes again.
I'm trying to capture / extract specific data within a string of text
in a cell. I need to capture a string of numeric characters plus only
the first alpha character immediately after the numbers. The numbers
of alpha characters varies before the numeric characters. So my cells
could look like this: TTTTT10TTTTTT or TTT1000TTTT or
TTTTTTT1TTTTTTTTTTTT etc.. My output from the cells would be 10T or
1000T or 1T etc... The text string before and after the number string
vary. Can this be done?- Hide quoted text -


- Show quoted text -


Hi. First, thanks for the help. The formula doesn't seem to work.
Can someone test it or explain what I'm possibly doing wrong?

  #5  
Old February 4th, 2009, 02:32 AM posted to microsoft.public.excel.worksheet.functions
KLZA
external usenet poster
 
Posts: 47
Default Help with MID Function?

On Feb 3, 9:13*pm, "Rick Rothstein"
wrote:
Can you describe what "doesn't seem to work" means? What do you see the
formula returning? Did you change the cell references (the A1's) to the cell
that has your text?

Try this experiment. Put one of your text strings in A1; then click in A3 to
activate it (really, any cell will do); and then copy/paste the formula I
posted (do not try to re-type it) into the Formula Bar. and hit Enter. What
is displayed in A3?

--
Rick (MVP - Excel)

"KLZA" wrote in message

...
On Feb 3, 7:35 pm, "Rick Rothstein"





wrote:
Sure... just use the last formula I posted back in your first thread on
this
problem; namely,


=MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456 789")),LEN(LOOKUP(9E+307,**--LEFT(MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"012 3456789")),999),ROW(1:*9*99))))+1)


Change all the A1 references (4 of them) to whatever cell you have your
text
in. This formula can be copied down if necessary.


--
Rick (MVP - Excel)


"KLZA" wrote in message


....


Hi. I may not have explained myself well enough in my last post. So
here goes again.
I'm trying to capture / extract specific data within a string of text
in a cell. I need to capture a string of numeric characters plus only
the first alpha character immediately after the numbers. The numbers
of alpha characters varies before the numeric characters. So my cells
could look like this: TTTTT10TTTTTT or TTT1000TTTT or
TTTTTTT1TTTTTTTTTTTT etc.. My output from the cells would be 10T or
1000T or 1T etc... The text string before and after the number string
vary. Can this be done?- Hide quoted text -


- Show quoted text -


Hi. *First, thanks for the help. *The formula doesn't seem to work.
Can someone test it or explain what I'm possibly doing wrong?- Hide quoted text -

- Show quoted text -


I get an error after 9E+307,
  #6  
Old February 4th, 2009, 02:44 AM posted to microsoft.public.excel.worksheet.functions
Rick Rothstein[_2_]
external usenet poster
 
Posts: 2,013
Default Help with MID Function?

I'm not sure what to tell you... I tested the formula before I posted it and
I just tested it again and it works on my XL2003 worksheet without any
problems. You did copy/paste the formula into your Formula Bar, didn't you?

--
Rick (MVP - Excel)


"KLZA" wrote in message
...
On Feb 3, 9:13 pm, "Rick Rothstein"
wrote:
Can you describe what "doesn't seem to work" means? What do you see the
formula returning? Did you change the cell references (the A1's) to the
cell
that has your text?

Try this experiment. Put one of your text strings in A1; then click in A3
to
activate it (really, any cell will do); and then copy/paste the formula I
posted (do not try to re-type it) into the Formula Bar. and hit Enter.
What
is displayed in A3?

--
Rick (MVP - Excel)

"KLZA" wrote in message

...
On Feb 3, 7:35 pm, "Rick Rothstein"





wrote:
Sure... just use the last formula I posted back in your first thread on
this
problem; namely,


=MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456 789")),LEN(LOOKUP(9E+307,**--LEFT(MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"012 3456789")),999),ROW(1:*9*99))))+1)


Change all the A1 references (4 of them) to whatever cell you have your
text
in. This formula can be copied down if necessary.


--
Rick (MVP - Excel)


"KLZA" wrote in message


...


Hi. I may not have explained myself well enough in my last post. So
here goes again.
I'm trying to capture / extract specific data within a string of text
in a cell. I need to capture a string of numeric characters plus only
the first alpha character immediately after the numbers. The numbers
of alpha characters varies before the numeric characters. So my cells
could look like this: TTTTT10TTTTTT or TTT1000TTTT or
TTTTTTT1TTTTTTTTTTTT etc.. My output from the cells would be 10T or
1000T or 1T etc... The text string before and after the number string
vary. Can this be done?- Hide quoted text -


- Show quoted text -


Hi. First, thanks for the help. The formula doesn't seem to work.
Can someone test it or explain what I'm possibly doing wrong?- Hide quoted
text -

- Show quoted text -


I get an error after 9E+307,

  #7  
Old February 4th, 2009, 03:05 AM posted to microsoft.public.excel.worksheet.functions
KLZA
external usenet poster
 
Posts: 47
Default Help with MID Function?

On Feb 3, 9:44*pm, "Rick Rothstein"
wrote:
I'm not sure what to tell you... I tested the formula before I posted it and
I just tested it again and it works on my XL2003 worksheet without any
problems. You did copy/paste the formula into your Formula Bar, didn't you?

--
Rick (MVP - Excel)

"KLZA" wrote in message

...
On Feb 3, 9:13 pm, "Rick Rothstein"





wrote:
Can you describe what "doesn't seem to work" means? What do you see the
formula returning? Did you change the cell references (the A1's) to the
cell
that has your text?


Try this experiment. Put one of your text strings in A1; then click in A3
to
activate it (really, any cell will do); and then copy/paste the formula I
posted (do not try to re-type it) into the Formula Bar. and hit Enter.
What
is displayed in A3?


--
Rick (MVP - Excel)


"KLZA" wrote in message


....
On Feb 3, 7:35 pm, "Rick Rothstein"


wrote:
Sure... just use the last formula I posted back in your first thread on
this
problem; namely,


=MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456 789")),LEN(LOOKUP(9E+307,***--LEFT(MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"012 3456789")),999),ROW(1*:*9*99))))+1)


Change all the A1 references (4 of them) to whatever cell you have your
text
in. This formula can be copied down if necessary.


--
Rick (MVP - Excel)


"KLZA" wrote in message


....


Hi. I may not have explained myself well enough in my last post. So
here goes again.
I'm trying to capture / extract specific data within a string of text
in a cell. I need to capture a string of numeric characters plus only
the first alpha character immediately after the numbers. The numbers
of alpha characters varies before the numeric characters. So my cells
could look like this: TTTTT10TTTTTT or TTT1000TTTT or
TTTTTTT1TTTTTTTTTTTT etc.. My output from the cells would be 10T or
1000T or 1T etc... The text string before and after the number string
vary. Can this be done?- Hide quoted text -


- Show quoted text -


Hi. First, thanks for the help. The formula doesn't seem to work.
Can someone test it or explain what I'm possibly doing wrong?- Hide quoted
text -


- Show quoted text -


I get an error after 9E+307,- Hide quoted text -

- Show quoted text -


Hey, I tested on two other machines and I think your formula may be
faulty. I'm using excel 2003 with different builds.. Can someone
else test this?
  #8  
Old February 4th, 2009, 03:08 AM posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
external usenet poster
 
Posts: 3,719
Default Help with MID Function?

On Tue, 3 Feb 2009 16:17:46 -0800 (PST), KLZA wrote:

Hi. I may not have explained myself well enough in my last post. So
here goes again.
I'm trying to capture / extract specific data within a string of text
in a cell. I need to capture a string of numeric characters plus only
the first alpha character immediately after the numbers. The numbers
of alpha characters varies before the numeric characters. So my cells
could look like this: TTTTT10TTTTTT or TTT1000TTTT or
TTTTTTT1TTTTTTTTTTTT etc.. My output from the cells would be 10T or
1000T or 1T etc... The text string before and after the number string
vary. Can this be done?



Repeating my last post:

Easy to do with a UDF:

To enter this alt-F11 opens the VB Editor. Ensure your project is
highlighted in the Project Explorer window, then Insert/Module and paste the
code below into the window that opens.

To use this, enter a formula of the type:

=extrNumsPlusOne(A1)

The pattern (in the UDF below) will find the first series of digits and a
following single alpha character.

==============================
Function extrNumsPlusOne(str As String) As String
Dim re As Object, mc As Object
Set re = CreateObject("vbscript.regexp")
re.Pattern = "\d+[A-Za-z]"
If re.test(str) = True Then
Set mc = re.Execute(str)
extrNumsPlusOne = mc(0).Value
End If
End Function
============================
--ron
--ron
  #9  
Old February 4th, 2009, 03:27 AM posted to microsoft.public.excel.worksheet.functions
JeffP->
external usenet poster
 
Posts: 29
Default Help with MID Function?

Here's a VBA example, not as neat as a worksheet function but here ya go...

Cells A1:I1
TTTT100TT
cell J1 enter =GetNumAndChar(A1:I1)

Dragging the lower right corner of this cell to other locations create the
referrenced incremented ranges.

HTH

begin copy omit this line
Option Explicit

Public Function GetNumAndChar(ByVal rRange As Excel.Range) As String

Dim in_value As String
Dim iRow, iCol, iposit, iStop As Integer
in_value = ""
iRow = 1

For iCol = 1 To rRange.Cells.Count
If rRange.Cells(iRow, iCol) = "." Then iCol = iCol + 1
If IsNumeric(rRange.Cells(iRow, iCol)) Then
in_value = in_value & rRange.Cells(iRow, iCol)
If IsNumeric(rRange.Cells(iRow, iCol)) And Not
IsNumeric(rRange.Cells(iRow, iCol + 1)) Then
in_value = in_value & rRange.Cells(iRow, iCol + 1)
Exit For
End If
End If
Next

If IsNull(in_value) Then
GetNumAndChar = " "
Else: GetNumAndChar = in_value
End If

End Function
end copy omit this line

"KLZA" wrote:

Hi. I may not have explained myself well enough in my last post. So
here goes again.
I'm trying to capture / extract specific data within a string of text
in a cell. I need to capture a string of numeric characters plus only
the first alpha character immediately after the numbers. The numbers
of alpha characters varies before the numeric characters. So my cells
could look like this: TTTTT10TTTTTT or TTT1000TTTT or
TTTTTTT1TTTTTTTTTTTT etc.. My output from the cells would be 10T or
1000T or 1T etc... The text string before and after the number string
vary. Can this be done?




  #10  
Old February 4th, 2009, 03:27 AM posted to microsoft.public.excel.worksheet.functions
Rick Rothstein[_2_]
external usenet poster
 
Posts: 2,013
Default Help with MID Function?

You are right... there is a problem with the formula IF your number starts
with one or more zeroes. I'll look into trying to correct it.

--
Rick (MVP - Excel)


"KLZA" wrote in message
...
On Feb 3, 9:44 pm, "Rick Rothstein"
wrote:
I'm not sure what to tell you... I tested the formula before I posted it
and
I just tested it again and it works on my XL2003 worksheet without any
problems. You did copy/paste the formula into your Formula Bar, didn't
you?

--
Rick (MVP - Excel)

"KLZA" wrote in message

...
On Feb 3, 9:13 pm, "Rick Rothstein"





wrote:
Can you describe what "doesn't seem to work" means? What do you see the
formula returning? Did you change the cell references (the A1's) to the
cell
that has your text?


Try this experiment. Put one of your text strings in A1; then click in
A3
to
activate it (really, any cell will do); and then copy/paste the formula
I
posted (do not try to re-type it) into the Formula Bar. and hit Enter.
What
is displayed in A3?


--
Rick (MVP - Excel)


"KLZA" wrote in message


...
On Feb 3, 7:35 pm, "Rick Rothstein"


wrote:
Sure... just use the last formula I posted back in your first thread
on
this
problem; namely,


=MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456 789")),LEN(LOOKUP(9E+307,***--LEFT(MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"012 3456789")),999),ROW(1*:*9*99))))+1)


Change all the A1 references (4 of them) to whatever cell you have
your
text
in. This formula can be copied down if necessary.


--
Rick (MVP - Excel)


"KLZA" wrote in message


...


Hi. I may not have explained myself well enough in my last post. So
here goes again.
I'm trying to capture / extract specific data within a string of
text
in a cell. I need to capture a string of numeric characters plus
only
the first alpha character immediately after the numbers. The numbers
of alpha characters varies before the numeric characters. So my
cells
could look like this: TTTTT10TTTTTT or TTT1000TTTT or
TTTTTTT1TTTTTTTTTTTT etc.. My output from the cells would be 10T or
1000T or 1T etc... The text string before and after the number
string
vary. Can this be done?- Hide quoted text -


- Show quoted text -


Hi. First, thanks for the help. The formula doesn't seem to work.
Can someone test it or explain what I'm possibly doing wrong?- Hide
quoted
text -


- Show quoted text -


I get an error after 9E+307,- Hide quoted text -

- Show quoted text -


Hey, I tested on two other machines and I think your formula may be
faulty. I'm using excel 2003 with different builds.. Can someone
else test this?

 




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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:37 AM.


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