Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default splitting string in 2 parts


I have 1 string which contains the value like "25-32". I want to spli
it in 2 strings such that the value of
string1="25"
string2="32"

Please help me out,
Regards.
Ashis

--
ashishpre
-----------------------------------------------------------------------
ashishprem's Profile: http://www.excelforum.com/member.php...fo&userid=3148
View this thread: http://www.excelforum.com/showthread.php?threadid=51221

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default splitting string in 2 parts

As this is in programming, I guess that you want vba.

ary = Split("25-32", "-")
string1 = ary(0)
string2 = ary(1)


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"ashishprem" wrote
in message ...

I have 1 string which contains the value like "25-32". I want to split
it in 2 strings such that the value of
string1="25"
string2="32"

Please help me out,
Regards.
Ashish


--
ashishprem
------------------------------------------------------------------------
ashishprem's Profile:

http://www.excelforum.com/member.php...o&userid=31485
View this thread: http://www.excelforum.com/showthread...hreadid=512210



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default splitting string in 2 parts

This is called parsing, with a delimiter of "-".
Assuming the numbers can be bigger or smaller, use code similar to:

txt = "25-32"
delim="-"
loc = instr(txt,delim)
string1 = mid(txt,1,loc-1)
string2 = mid(txt,loc+1)


"ashishprem" wrote:


I have 1 string which contains the value like "25-32". I want to split
it in 2 strings such that the value of
string1="25"
string2="32"

Please help me out,
Regards.
Ashish


--
ashishprem
------------------------------------------------------------------------
ashishprem's Profile: http://www.excelforum.com/member.php...o&userid=31485
View this thread: http://www.excelforum.com/showthread...hreadid=512210


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
Splitting a file with lookup functions into smaller parts Dave McD Excel Worksheet Functions 3 October 25th 07 12:04 AM
Splitting a text string into string and number mcambrose Excel Discussion (Misc queries) 4 February 21st 06 03:47 PM
Splitting String into Consitiutent Parts including spaces characte ExcelMonkey Excel Programming 11 February 8th 06 12:48 PM
Extract certain parts of string djDaemon Excel Worksheet Functions 3 February 2nd 06 07:42 PM
Extract certain parts of string djDaemon Excel Worksheet Functions 0 February 2nd 06 03:31 PM


All times are GMT +1. The time now is 10:30 PM.

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

About Us

"It's about Microsoft Excel"