[mso] Re: Excel Formula

  • From: "Ray Blake" <ray@xxxxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Thu, 18 Aug 2005 18:35:04 +0100

Here's a custom function that will do the job for you:

------------------------------------------------------------------------
-------
Function FiveAfterText(strContent As String)
Dim boFlag As Boolean
Dim intChar As Integer
Dim strChar As String

intChar = 1
Do Until boFlag = True
    strChar = LCase(Mid(strContent, intChar, 1))
    If Asc(strChar) >= 97 And Asc(strChar) <= 122 Then
        boFlag = True
    End If
    intChar = intChar + 1
Loop
    
FiveAfterText = Mid(strContent, intChar, 5)

End Function
------------------------------------------------------------------------
-------

Put this function in a module. If your string is in A1, you can get the
five number string you need in any cell by entering this formula:

        =FIVEAFTERTEXT(A1)

Ray

------------------------------------
GR Business Process Solutions
Ray Blake
Head of Software Design
ray@xxxxxxxxx
Braedon
Newell Road
Hemel Hempstead
Herts HP3 9PD
tel: 01442 396518
fax: 01442 389353
mobile: 07834 226601
www.grbps.com
------------------------------------


-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On
Behalf Of McDonald, Christine, Ms, DCAA
Sent: 18 August 2005 17:46
To: mso@xxxxxxxxxxxxx
Subject: [mso] Excel Formula


I know I've done this before, but can't find the formula again.  I have
a column of data that I need to extract the 5 characters after the first
letter in cell.  So, for instance, if I have a cell that has
04421-2005B12345789-test I need to extract the 12345.  The data is not
the same length in each cell, so the text to columns or mid feature
won't work.
 
Any help is appreciated.
Thanks,
 

Christine McDonald, CPA
Technical Specialist
Western Regional Office
Information Technology Division (RSA-4)


 

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx
or MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the
quotes) in the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will
also allow you to change your email settings to digest or vacation (no
mail). //www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group,
send a request to mso-moderators@xxxxxxxxxxxxx and you will be sent an
invitation with instructions.  Once you are a member of the files group,
you can go here to upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: