Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have string like that : NESN 380.7 STR 01/28/2008 and I want to be able to grab the value between the first two spaces; 380.7. I know how to find the first space but I don't know how to find the second one. Does anyone know? Thanks, Kathy |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Kathy,
Fuction GetPart(InputStr as string, Position as long, Optional Delim as string=" ") as string GetPart=Split(InputStr,Delim)(position) 'Add error handling in case invalid values End Function So call it with : Dim Val as variant Val=GetPart("NESN 380.7 STR 01/28/2008",2) NickHK egroups.com... Hi, I have string like that : NESN 380.7 STR 01/28/2008 and I want to be able to grab the value between the first two spaces; 380.7. I know how to find the first space but I don't know how to find the second one. Does anyone know? Thanks, Kathy |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Nick!
This is exactly what I was looking for. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Nick!
This is exactly what I was looking for. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick,
Nice, except Split returns a 0 based array, so you should use GetPart=Split(InputStr,Delim)(position - 1) HTH, Bernie MS Excel MVP "NickHK" wrote in message ... Kathy, Fuction GetPart(InputStr as string, Position as long, Optional Delim as string=" ") as string GetPart=Split(InputStr,Delim)(position) 'Add error handling in case invalid values End Function So call it with : Dim Val as variant Val=GetPart("NESN 380.7 STR 01/28/2008",2) NickHK egroups.com... Hi, I have string like that : NESN 380.7 STR 01/28/2008 and I want to be able to grab the value between the first two spaces; 380.7. I know how to find the first space but I don't know how to find the second one. Does anyone know? Thanks, Kathy |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bernie,
Yeah, it's getting late here. And not testing what you write, however (apparently) simple. Thanks NickHK "Bernie Deitrick" <deitbe @ consumer dot org .gbl... Nick, Nice, except Split returns a 0 based array, so you should use GetPart=Split(InputStr,Delim)(position - 1) HTH, Bernie MS Excel MVP "NickHK" wrote in message ... Kathy, Fuction GetPart(InputStr as string, Position as long, Optional Delim as string=" ") as string GetPart=Split(InputStr,Delim)(position) 'Add error handling in case invalid values End Function So call it with : Dim Val as variant Val=GetPart("NESN 380.7 STR 01/28/2008",2) NickHK egroups.com... Hi, I have string like that : NESN 380.7 STR 01/28/2008 and I want to be able to grab the value between the first two spaces; 380.7. I know how to find the first space but I don't know how to find the second one. Does anyone know? Thanks, Kathy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find String in another string - only between spaces | Excel Worksheet Functions | |||
Removing Spaces from string | Excel Worksheet Functions | |||
counting spaces in a string | Excel Programming | |||
counting spaces in a string | Excel Programming | |||
Count Spaces In A String | Excel Programming |