ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   splitting string in 2 parts (https://www.excelbanter.com/excel-programming/353245-splitting-string-2-parts.html)

ashishprem[_4_]

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


Bob Phillips[_6_]

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




Antonio Elinon[_2_]

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




All times are GMT +1. The time now is 09:16 AM.

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