ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determine data type in a string (https://www.excelbanter.com/excel-programming/400327-determine-data-type-string.html)

news.epix.net

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



Bob Phillips

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





Dave Peterson

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

Gary''s Student

Determine data type in a string
 
Use the =ISNUMERIC() function
--
Gary''s Student - gsnu200752

Bob Phillips

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







Ron Rosenfeld

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


All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com