473,385 Members | 1,782 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How do I separate data in one column into two columns and then make the columns turn

I have sample output data that comes out in column form like this:

1:1
2:3
4:5

I need to separate the values into individual columns and then make it go across rows to end up looking like this:

1 1 2 3 4 5

I want to do this in Excel or Access. I can make excel separate it into 1 1 OR move it to rows but I can't figure out how to do both.
Apr 24 '14 #1
7 1782
anvidc
28
you can use Split & array()

Expand|Select|Wrap|Line Numbers
  1. Dim i as Integer
  2. Dim xStr as String
  3. Dim xArr() As String
  4.  
  5. xStr = "1:1"
  6. xArr = Split(xStr, ":")
  7.  
  8. For i= LBound(xArr) To UBound(xArr)
  9.   Debug.Print xArr(i)
  10. Next
Apr 24 '14 #2
@anvidc
So where do I type this?
Apr 24 '14 #3
anvidc
28
You Data is in excel or access or maybe you can upload some sample
Apr 24 '14 #4
Rabbit
12,516 Expert Mod 8TB
Why do you need to do this? It sounds like you're normalizing and then denormalizing your data. You should avoid denormalization unless you have a very good reason to do so because it just causes more headaches later on.
Apr 24 '14 #5
@Rabbit
I have an output file from a machine that needs to be reformatted to run in analysis software that runs in Command line and it's input requires it in row format, separated and without the colons.
Apr 24 '14 #6
@anvidc
This is a small sample of my data output
Attached Files
File Type: xlsx example.xlsx (9.6 KB, 373 views)
Apr 24 '14 #7
anvidc
28
This may not the best solution, but should help

1.Create a Module then paste this code in VB (Alt+F11)
2.Create a Button then assign to SlpOut Macro

Expand|Select|Wrap|Line Numbers
  1. Sub SlpOut()
  2.  
  3. Dim xC As Range
  4. Dim xArr() As String
  5. Dim i As Long
  6. Dim LRow As Long
  7.  
  8. For Each xC In Range("B1:B" & Range("B1").End(xlDown).Row)
  9.     xArr = Split(xC.Cells.Value, ":")
  10.     For i = LBound(xArr) To UBound(xArr)
  11.         LRow = WorksheetFunction.CountA(Range("D:D")) + 1
  12.  
  13.         Range("D" & LRow).Value = xArr(i)
  14.     Next i
  15. Next xC
  16.  
  17. End Sub
  18.  
Apr 25 '14 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: alederer | last post by:
Hallo! I need to convert the values of a varchar (..) for bit data column to a string which can be stored in a normal varchar column (with additional information). Is there a function in db2...
0
by: andrewcw | last post by:
After I made a nice application with WINFORM I tried to apply much of the same code, but there are lost of differences. I load the grid colors, column width, column header from a xml data file....
6
by: Hutty | last post by:
I've looked around and have yet to find anything that would answer my question regarding formating a column in a datagrid. My grid looks like this as far as data" AMHQCON|51300.01|-3147 The...
0
by: Gilgamesh | last post by:
I'm retrieving a data column from SQL Server 2000 which has the type Varchar with length set to 10. The MaxLength method of DataColumn object returns -1 instead of the correct size which is 10....
1
by: neeraj | last post by:
Hi All Can any give me the code for convert "DataColumn" data type of "DataTable". Even if data table already populated (have data) Actually I am creating one search module which searches the...
2
by: schaapiee | last post by:
Is there a way to define how long the data columns are, display wise on the Form? Whether I am using a boolean field (checkbox) or a string field (text url) each displays with the same size. I...
1
by: phasita | last post by:
I would like to separate data in text file. For example A 35 160 B 25 145 C 40 130 the first column is name of member,the second column is age and the last one is...
1
by: prasadgopathi | last post by:
hi friends, i have one table is normal column is bit id isnormal 1 0 2 0 3 0 4 1
1
by: ncsthbell | last post by:
I am on MS Office 2007. How can I set the data column property on a form to allow a user to enter a data value in the column to perform a ‘find’ but not change the table data for the record that is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.