Converting Pipe Delimited Data String Into Separate Columns Using VBA Macro

Mar 6, 2014

I have a string of data coming from a SQL Server data connection into my workbook. The value in the column is a text string that is pipe delimited. I need a macro to parse the data from that column into applicable separate columns. I would typically use text to columns for this and parse it out manually... but the tool I'm creating is one of the automated variety, so that will not suffice for this application. I need it to do this automatically when the data connection refreshes.

U:U AQ AR AS AT AU AV
to
Produce|Fruit|apple|banana|cherry|date Produce Fruit apple banana cherry date

View 2 Replies


ADVERTISEMENT

Macro To Copy Data From Excel And Creates Pipe Delimited Text File

May 27, 2014

Macro to copy data from Excel sheet and creates a Pipe delimited text file.

View 10 Replies View Related

Exporting To Pipe Delimited

Dec 27, 2007

Figured out how to export to Pipe Delimited through coding but now I am faced with 2 complications.

1) The column order in the EXCEL file is not the Order I want it to Export in. (i.e. COB Date maybe in Column 'I' in the Excel File but when I export it into .txt I need it to be in the First Column)

2) I need to have the header name Changed in the .txt file (i.e. COB Date is the name in the EXCEL file but I need it to show as cob_date in the .txt file)

View 9 Replies View Related

Convert XLS To Pipe-delimited TXT File

Jul 15, 2009

I have the following code (borrowed) which converts the current .xls worksheet to a tab-delimited .txt file. The problem is that i need to add a PIPE to the end of each row/record as well, so that the records would look something like this:

A|123|
B|456|

currently there is no PIPE following the last character (3 or 6) and i am getting this:

A|123
B|456

I was hoping there would be a way to revise the VBA to add a PIPE at the end of each row/record.

Here's the code:

[Code] ......

View 10 Replies View Related

Convert .xls To Pipe-delimited .txt File

Jul 15, 2009

I have the following code (borrowed) which converts the current .xls worksheet to a tab-delimited .txt file. The problem is that i need to add a PIPE to the end of each row/record as well, so that the records would look something like this:

A|123|
B|456|

currently there is no PIPE following the last character (3 or 6) and i am getting this:

A|123
B|456

I was hoping there would be a way to revise the VBA to add a PIPE at the end of each row/record. Here's the ...

View 4 Replies View Related

Separate Space$ Delimited String Into Multiple Cells

Oct 13, 2009

I am trying to split a string into separate cells. I have managed to generate the formula for the description and first dlr value in the string but I am have trouble figuring out how to build functions for the rest of the string.

Example attached.

View 3 Replies View Related

Converting Data In Two Columns Into A Row On Separate Sheet

Oct 20, 2011

I have data in two columns on the same sheet that I need to transpose into rows on a separate sheet (same workbook). One problem is that I need to reference off one of these columns (column B - in Sheet "Gp Trg Plan") as the number of lines will vary.

Example - Sheet "Gp Trg Plan"
Column B Column D
Tower Module 1
Tower Module 2
Tower Module 3
Building Module 1
Building Module 8
Street Module 6

Ideally the row will look like.

Example - Sheet "Status WS"

Column A Column B Column C Column D Column E Column F Column G
Gp Name Sub Gp Person 1st Mod Date 2nd Mod Date

There is an undefined amount of training modules (columns D in Sheet "Gp Trg Plan"), but no more than 10.

View 4 Replies View Related

Remove Inverted Commas In PIPE Delimited File Created From VBA

Jun 3, 2014

i have a Macro, its creating unwanted inverted commas at the start and end of the File.

File:

"SunilManual|123456790|DrivingLicence|908567543|Sunil|Manchan
|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w
|w|w|w|w|w|w|w|w|w|w|w|ww|w|w|w|w|w|w|w|w|w|w
|w|w|w|w|w|w|w|w|w|w|55|55||4|SR-1161||1234567890"

Expected File:

|SunilManual|123456790|DrivingLicence|908567543|Sunil|Manchan
|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w
|w|w|w|w|w|w|w|w|w|w|w|ww|w|w|w|w|w|w|w|w|w|w
|w|w|w|w|w|w|w|w|w|w|55|55||4|SR-1161||1234567890|

VBA:

Option Explicit
Sub txtt_export()
Dim buf As String, col As Long, r As Long, ws As Worksheet

[Code]....

View 2 Replies View Related

Split Concatenated Delimited Cell Values Into Separate Columns

Jun 20, 2014

Im trying to come up with an automated way of splitting concatenated information but putting each concatenated value in a seperate row.( i have columns of data that need to stay with each concatenated value) Eg

Concatenated comma delimited data

Cust Name Cust Identifier Locations
L Kim 543545 California,Chicago,Florida
S David 31434 Maryland,Vermont,Maine
D Bryant 572575 Texas,Oaklahoma,Nebraska

i need to to get a result that looks like the below example im currently just doing text to column filterting and copying all the columns over and stacking them on top of each other. i need to find a way to automate this process but i cant seem to think of one

Customer name Customer Identifier Location
L Kim 543545 California
L Kim 543545 Chicago
L Kim 543545 Florida
S David 31434 Maryland
S David 31434 Vermont
S David 31434 Maine
D Bryant 572575 Texas
D Bryant 572575 Oaklahoma
D Bryant 572575 Nebraska

View 2 Replies View Related

Separate Letters And Numbers In A String Into Separate Columns

Nov 20, 2012

I receive an extraction from AutoCAD that lists the electrical devices in a drawing. I don't have any problems extracting the letters. I have a problem extracting the device number and the device number extension.

The device label extraction is similar to this:
DCM1005-1
DCM1005-10
DCM1005A
MTR1005-1
MTR1005-10
MTR1005A

I want to create 3 columns from the device label: (I separated the column with commas)
A1, B1, C1, D1
DCM1005-1, DCM, 1005, 1
DCM1005-10, DCM, 1005, 10
DCM1005A, DCM, 1005, A
MTR1005-1, MTR, 1005, 1
MTR1005-10, MTR, 1005, 10
MTR1005A, MTR, 1005, A

View 5 Replies View Related

Converting Text To Columns For A String

Jul 31, 2012

I have a problem in converting text to columns for a string that has 1000+ entry's. Excel bumps me out after 851 using the Split function.

The data I can only download in a text format has >1000 fields that are seperated by ",". Not a problem so far but when I attempt to convert to columns there is a maximum limitation of 851.

Data1,Data2,Data3,Data4...................Data1000,Data1001,Data1002 etc...

I have tried:

Sub Split_Delimeter()
Dim Words() As String
Words = Split(Cells(2, 4), ",")
MsgBox "String contains " & (UBound(Words) + 1) & " words"
End Sub

View 2 Replies View Related

Converting A String Of Letters In A Row Into Columns

Oct 5, 2009

I have a set of letters in a single row DISATAGFOORCBORDQFINFCOBBKIEHDSMCNRSKARDFCJSLCQCECFVSBCBOYKPVYKC. I want to distibute them across 5 columns such that each letter occupies one cell. I might want to specify a different column width later on so the solution should be flexible.

View 5 Replies View Related

Converting Pdf Cut And Pasted Data Into Separate Cells

Jan 26, 2009

I have rxd a pdf file that I need to manipulate I have copied the data into excel and now need it in individual cells:? The data looks like this: 02392950067 19/12/2008 14:33:35 02392950053 Portsmouth 1.9 £0.03. this is:

phone number calling | date called | time called | number called | duration in minutes | cost of call. If you're out there I'd be more than happy to hear from you. the cells to cut the data into will be formatted to take the data in the correct form. 02392950067 19/12/2008 14:33:35 02392950053 Portsmouth 1.9 £0.03
phone number calling | date called | time called | number called | duration in minutes | cost of call.

View 3 Replies View Related

Macro VBA For Copy Paste Columns Of Data From Three Tabs Into One Column On Separate Sheet

Nov 18, 2013

I have a workbook with four tabs or four sheets.

Tabs 1, 2 and 3 have a column of data (Column A) on each sheet. They all start from the same cell. Each cell of data are just numbers. The column (an array) of data will not have blanks between.

But, they are not the same number of data. They vary.

Meaning, Tab 1 may have 15 numbers (A1 to A15), Tab 2 may have 20 numbers (A1 to A20) and Tab 3 could have 5 numbers (A1 to A5). Each iteration of the workbook may have different number of data in the A column on these tabs.

Now on Tab 4, I want combine the data from all three tabs into one column (in column A).

So, Tab 4 has a column A with data from Tab 1 copy and pasted to (A1 to A15) as values, then (A16 to A35) have Tab 2 data copy pasted as values and (A36 to A40) have Tab 3 data copy pasted as values.

Basically, the macro on Tab 4 has to count the number of rows on each Tab that are populated with data values and figure out to copy all the data on Column A from each three tabs and paste the data value into the Tab 4 in one column of data (in values).

View 6 Replies View Related

Splitting Text String (address) Into Separate Columns

Jun 2, 2014

I have address that sits in one cell only and I need to separate into two or three columns (streetname, street number, streetletter).

Is this possible as the length of street text, numbers and letter differs all the time...

Attached is a sample file with before and after result

address.xls‎

View 5 Replies View Related

Split Address Text String Into Separate Columns

Mar 13, 2009

I would like to "reverse concatenate" an address text string as follows: ....

View 9 Replies View Related

Convert Space-delimited Data To Columns

Jun 9, 2009

I have a software package that requires serial number effectively data to be entered in a particular format.

As this can cover hundreds of lines I would like to make it less tedious to enter, and as my MACRO knowledge is very basic.

The data starts off in format below in example 1. After the data is CUT from the .html or .pdf document and PASTE into EXCEL. I would like the MACRO to start by pressing an activate button within EXCEL,

The serial numbers always have four digits with single serial numbers being separated by spaces and ranges being separated by a hyphen with the odd carriage return depending on how many numbers there are.

I would like the data to end up in two separate columns as shown in example 2.


Example 1 (Starting format)
* indicates space
- indicates a range, this needs to be separated into two separate columns

2252*2254*2256*2257*2259*2272*2274-2276*2278*2280*2282*2284*2286-2641*2643-2681*2683-2712*2714-2717*2719*2721*2724*2726*2727*2729* 2733*2735 *2738*2739*2746

Example 2 (Finished format ready to be paste into software package
2252
2254
2256
2257
2259
2272
2274 2276...............................

View 12 Replies View Related

Transpose Data From Rows To Columns, Export To A Tab Delimited File

Mar 12, 2003

I was wondering if their is a simple macro to transpose data from rows to columns so I can export to a tab delimited file. This particular list is 5 lines underneath each other and then the next entry.

There are no spaces between entries.

View 9 Replies View Related

Separate Comma-delimited Values To Rows

Oct 22, 2009

I have an excel sheet I create with lots of inventory items distributed amongst several locations. The first column is a location field where several 1-2 digit location codes are seperated by commas. I would love to get the macro to copy each row, once for each location code, onto a new tab as a new longer list. Because the amount of data per row varies, I need the entire row to be copied to the new tab....

View 10 Replies View Related

Separate Comma Delimited Cells To New Rows

Mar 31, 2008

I have a 5K rows of data, each including a cell (AD) of multiple number values, separated by comma. I would like to create a new row for each unique number in column AD such that there remains only one unique value for every AD cell.

If possible, I would prefer an in-cell formula rather than a macro.

View 9 Replies View Related

Macro To Separate String If Space Between

Jan 29, 2009

On sheet one, in the column column C I have cells which have characters separated by a space character (For example cell C3 looks like this: "L C"; cell C12 looks like this: "S BF54FR"). There are only a few cells which have more than three characters. The characters are separated by a space character. I would like the macro to do the following: take out each on of the character in put in the same row next column. (For example if in column C has the value: "L C" then in the same row column D should have the value "L" and column E should have the value "C". Or if column C was "S BF54FR" then column D should have the value "S" and column E "BF54FR".

View 6 Replies View Related

Macro To Separate String Into Three Cells

Nov 17, 2011

Is there any way to create a macro for the following:

I have the following format

First Name MI Last Name in Column A.

Sometimes there is a space on the last name for someone with a last name Mc Cormick (for example)

Also, sometimes the list of names is short and sometimes the list of names is long. Is there a way to get a "universal" macro in place, that will not depend on the number of names in the list but will be able to detect when the list ends?

So far I was able to run the macro to get them from text-to-column into cells A, B, and C. However, the middle column sometimes contains the last name if there isn't a middle initial. I need a way to test the middle column for more than one character. If there is more than one character, it is a last name and needs to be in the third column.

View 7 Replies View Related

Subtracting 2 Columns Of Data From Each Other When Labels In Separate Columns Match

Feb 20, 2009

I have four columns of data, as follows:

label 1, value 1, label 2, value 2

I need to create a formula in the fith column that for each line will tell excel to:

look for entry in 'label 1' in 'label 2' if there is a match, then subtract value 1 from value 2, display result.

I have tried doing this with SUMIF but am getting nowhere fast....

View 7 Replies View Related

Search Comma Delimited String

Dec 1, 2009

I have a spreadsheet with a number of columns containing comma delimited strings (years) which I need to check cell by cell and return false if anything apart from the years 2001 to 2008 is found.

For instance, a cell may contain the years (2001, 2005, 2006, 2007, 2008) or (2006, 2007) or (2001, 2004, 2008) or (2004) or any combination of those 8 years.

I thought of using the Split function on each cell and then looping through the resultant array to do a comparison against each of the 8 years but with a large number of delimited strings to check it could be a bit time consuming. Any idea how I could accomplish this more quickly and efficiently either with a formula or VBA?

View 9 Replies View Related

How To Split Text From Text String Into Separate Columns - No Delimiters

Apr 8, 2014

I have the cell data as below

How would I split into a new column the first part which is a date into a new column, then the country and the remainder into separate columns?

I still want the original data as I need to check that the splits worked well?

16.5.90 CH 1671/90-4
18.10.1991 CH 3056/91-1
24.07.92 ch 2341/92-2
30.7.92 ch 2395/92-3
18.11.92 Us 3533/92-5
26.5.93PCT 1577/93-0
9.8.93 CH 2363/93-8
17.8.93 CH 2445/93-0
25.1.94ch209/94-6;8.12.94ch3714/94-1
25.1.94 ch 209/94-6 ; 8.12.94 ch 3714/94-1
8.4.94 ch 1047/94-0
22.4.94 ch 1255/94-7
18.11.1992 CH 3533/92-5
18.11.1992CH 3533/92-5

View 2 Replies View Related

Covert Space Delimited String To Array

Apr 24, 2008

I have two columns of data, one for Position, and one for description.

The positions are concatenated and separated by spaces. E.g. C1 C2 C3 for each Description. I need to create a separate row for each position

So I need to convert:

Pos Decscription
C1 C2 C3 Cap 100n 10% X7R 0805

to:

Pos Decscription
C1 Cap 100n 10% X7R 0805
C2 Cap 100n 10% X7R 0805
C3 Cap 100n 10% X7R 0805

Or in other words split a space delimited string into an array, so that I can loop through the array, and add new rows

View 9 Replies View Related

Converting Data Into Rows And Columns

Jan 12, 2010

I am trying to figure out an efficient way to convert data into Excel. The data is not in a row/column format. The format that I received the data in is as follows (2 columns; column labels repeating for each name in column A, and the corresponding data in column B. See below. Any ideas on how to best to convert this data into column labels across the top and data in rows under each column heading?

Column A Column B
Name John Doe
Address 123 Maple Street
City Any City
State Any State
Zip 12345
First Name John
Last Name Doe
BLANK ROW
Name Jane Doe
Address 123 Maple Street
City Any City
State Any State
Zip 12345
First Name Jane
Last Name Doe

View 9 Replies View Related

Creating Panel Data By Converting Several Columns Into One

Jun 20, 2011

My problem: I have downloaded national economic data from IMF with several countries for several years. I need several variables and must extract them individually so I a need a clever solution to my problem.

I currently have data that is sorted like below. The "-" indicates a numerical gdp value for the given country for the given year.;

(FYI I could not get the "-" to align beneath 2001-2004 and year respectively.)

Country 2001 2002 2003 2004
x - - - -
y - - - -
z - - - -

The identifier here is country, and the data is as such structured as cross sectional data, with each yearly account of gdp being a variable. Now, I need this data as panel data, organized as below:

Country year gdp
x 2001 -
x 2002 -
x 2003 -
x 2004 -

I sort of say, need to "flip it". As I have 180 countries and 11 years, and need to do this with 2-3 variables, I need either a formula or a VBA to run.

View 12 Replies View Related

Converting Conditional Data In Rows To Columns

Aug 23, 2009

How can I convert a table from rows to columns as shown below??? Thanks for the feedback...

Current file with:

Unit_no work_order_date

1234 1/1/2005
1234 6/10/2006
1234 10/1/2007
4321 2/3/2004
4321 5/12/2005

Change to:

Unit_no work_order_date work_order_date2

1234 1/1/2005 6/10/2006
1234 6/10/2006 10/1/2007
4321 2/3/2004 5/12/2005

Will be working with data to sum data between the two work order dates...

View 9 Replies View Related

How To Separate CSV Data Into Different Columns

May 22, 2013

how to separate .csv data into different columns in excel?

e.g this .csv data

2012.09.07,07:00,125.78800,126.12500,125.76800,126.02300,6664
2012.09.07,08:00,126.02100,126.19800,125.93900,126.05000,4707
2012.09.07,09:00,126.05100,126.11300,125.96700,125.99800,4178
2012.09.07,10:00,126.00000,126.02900,125.71700,125.77800,6389
2012.09.07,11:00,125.78300,125.91400,125.62800,125.66400,5388
2012.09.07,12:00,125.66300,125.86900,125.04100,125.12300,10447

[Code]....

View 11 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved