Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Determine data type in a string

Could someone please tell me how to determine the data type of each char of
a string?

I have worksheets named 'October07'. I need to extract just the month name
first and then
the year number.

I would like to loop thru the string until I find an integer character.

Thanks,
M. Miller


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Determine data type in a string

=LEFT(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123 456789"))-1)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"news.epix.net" wrote in message
...
Could someone please tell me how to determine the data type of each char
of a string?

I have worksheets named 'October07'. I need to extract just the month
name first and then
the year number.

I would like to loop thru the string until I find an integer character.

Thanks,
M. Miller




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Determine data type in a string

You can use isnumeric.

dim lCtr as long
dim myWord as string
dim myStr as string
myWord = "October07"
myStr = ""
for lctr = 1 to len(myword)
if isnumeric(mid(myword, lctr, 1)) then
'get out, we're done
exit for
else
myStr = mystr & mid(myword, lctr, 1)
end if
next lctr
msgbox mystr

(Watch for typos!)

"news.epix.net" wrote:

Could someone please tell me how to determine the data type of each char of
a string?

I have worksheets named 'October07'. I need to extract just the month name
first and then
the year number.

I would like to loop thru the string until I find an integer character.

Thanks,
M. Miller


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Determine data type in a string

Use the =ISNUMERIC() function
--
Gary''s Student - gsnu200752
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Determine data type in a string

Missed year number

=MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"01234 56789")),99)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Bob Phillips" wrote in message
...
=LEFT(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123 456789"))-1)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"news.epix.net" wrote in message
...
Could someone please tell me how to determine the data type of each char
of a string?

I have worksheets named 'October07'. I need to extract just the month
name first and then
the year number.

I would like to loop thru the string until I find an integer character.

Thanks,
M. Miller








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Determine data type in a string

On Wed, 31 Oct 2007 08:53:26 -0400, "news.epix.net" wrote:

Could someone please tell me how to determine the data type of each char of
a string?

I have worksheets named 'October07'. I need to extract just the month name
first and then
the year number.

I would like to loop thru the string until I find an integer character.

Thanks,
M. Miller


If your worksheets are all named with the last two characters being numeric,
then

Month = left(ws.name,len(ws.name)-2)
Year = right(ws.name,2) + 2000


--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
find string data type related functions clara Excel Programming 2 May 26th 07 12:33 PM
Determine file type David Sisson[_2_] Excel Programming 3 August 15th 06 09:13 AM
Can I determine the active selection's type? MartinS Excel Programming 4 January 13th 05 04:15 PM
Determine data type for Pivot Field Mike Dudash Excel Programming 0 January 22nd 04 09:20 PM
Determine File Type Brent[_5_] Excel Programming 2 January 6th 04 06:43 AM


All times are GMT +1. The time now is 12:52 AM.

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

About Us

"It's about Microsoft Excel"