PC Review


Reply
Thread Tools Rate Thread

Converting String to pairs.

 
 
UllSang@gmail.com
Guest
Posts: n/a
 
      11th May 2006
hello i have a file that was pre generated for me. it contains many
colums and rows.
a certian colum constains a string of 6 digits, like 272829 and 359514
and so on. I need those split up into pairs, either by comma or
something else so i can do a find and replace.
so it could look like 27,28,29 and 35,95,14. Any suggestions for how i
can automate it. I regularaly get theses lists and they contain 1200+
rows. it takes me hours. thanks for your help.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      11th May 2006
If A1 contains 123456 then =LEFT(A1,2) & "," & MID(A1,3,2) & "," & RIGHT(A1,2)

will display:
12,34,56


--
Gary''s Student


"(E-Mail Removed)" wrote:

> hello i have a file that was pre generated for me. it contains many
> colums and rows.
> a certian colum constains a string of 6 digits, like 272829 and 359514
> and so on. I need those split up into pairs, either by comma or
> something else so i can do a find and replace.
> so it could look like 27,28,29 and 35,95,14. Any suggestions for how i
> can automate it. I regularaly get theses lists and they contain 1200+
> rows. it takes me hours. thanks for your help.
>
>

 
Reply With Quote
 
Puppet_Sock
Guest
Posts: n/a
 
      11th May 2006
(E-Mail Removed) wrote:
> hello i have a file that was pre generated for me. it contains many
> colums and rows.
> a certian colum constains a string of 6 digits, like 272829 and 359514
> and so on. I need those split up into pairs, either by comma or
> something else so i can do a find and replace.
> so it could look like 27,28,29 and 35,95,14. Any suggestions for how i
> can automate it. I regularaly get theses lists and they contain 1200+
> rows. it takes me hours. thanks for your help.


Look up the functions len, left, right, and mid.

If there is no possibility of any number being other than six digits,
things are quite simple. You just put this in b1

=left(a1,2) & "," & mid(a1,3,2) & "," & right(a1,2)

and that splits it up. This assumes the first value is in cell a1,
and the rest following. Then just fill down.

If there is the possibility that some of those
numbers will be shorter than six digits, then it's a little more
complicated, and you would need to decide what to do with
those cases. Add zeros? Leave blanks? Something else?
So, for example, if a few of those numebrs were 5 digits,
but none less than 5, you need to decide if they become
01,56,23 or whatever, leading 0 or no leading 0. And you
need to decide if some are ever going to be 4 or less
digits, and what to do then.

If that happens, then you can do many things, some more
or less complicated. For example, if you wanted to have
leading 0's fill things in, you could make an intermediate
text-format column that does something like so.

left("000000",a1,6-len(a1)) & a1

This will then produce a string that is 6 chars long, with
0s at the front if the input number is less than 6. (But
note what happens if you ever get an input more than
6 chars long, namely BOOM!)
Socks

 
Reply With Quote
 
Dana DeLouis
Guest
Posts: n/a
 
      11th May 2006
Would something like this work for you?

=TEXT(A1,"##-##-##")

--
HTH. :>)
Dana DeLouis
Windows XP, Office 2003


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> hello i have a file that was pre generated for me. it contains many
> colums and rows.
> a certian colum constains a string of 6 digits, like 272829 and 359514
> and so on. I need those split up into pairs, either by comma or
> something else so i can do a find and replace.
> so it could look like 27,28,29 and 35,95,14. Any suggestions for how i
> can automate it. I regularaly get theses lists and they contain 1200+
> rows. it takes me hours. thanks for your help.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Converting String Pairs to IDictionary? Anthony Jones Microsoft Dot NET 1 30th Apr 2008 10:58 PM
Re: Parsing a string of tag=value pairs SStory Microsoft VB .NET 0 28th Aug 2004 04:13 PM
Anyone have a Regex pattern for finding name/value pairs in a string? Bill Microsoft C# .NET 1 16th Aug 2004 10:59 PM
How do I parse name/value pairs from a config string? Bill Microsoft Dot NET 4 16th Aug 2004 05:54 PM
How do I extract name-value pairs in C# ASP.NET from a string? =?Utf-8?B?R3JlZyBS?= Microsoft C# .NET 1 28th Mar 2004 08:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:41 AM.