Parse An Output File From X-12-arima Using Vba

Jul 10, 2006

I'm trying to parse an output file from x-12-arima using vba. The file is in this format

invalidate the results of this test For the last three year period.
ICMETI, Total Inventories Communications Equipment PAGE 9, SERIES foo

D 12 Final trend cycle
From 2002.Jan To 2005.Dec
Observations 48
Trend filter 13-term Henderson moving average
I/C ratio 1.08 .............

View 5 Replies


Import/parse Text File

Feb 16, 2009

I need 3 columns - Title - HD - Channel. If no value for HD, the field would be blank.

Data looks like this in txt file:
> A&E HD 265
> ABC Family HD 311
> Altitude Sports and Entertainment HD 681
> American Movie Classics (AMC) 254
> Animal Planet HD 282
> BBC America 264
> BET Jazz 330
> BYU TV 374
> Big Ten Network HD 220
> Black Entertainment Television (BET) 329
> Bloomberg Television 353
> Boomerang 298

Needs to look like this in Excel
> Should look like:
> A&E HD 265
> ABC Family HD 311
> Altitude Sports and Entertainment HD 681
> American Movie Classics (AMC) 254
> Animal Planet HD 282
> BBC America 264

View 9 Replies View Related

File Too Big...way To Parse Out Data And Write To Csv

Feb 12, 2010

I have a file with multiple tabs of data...lot's of data (each tab has 80,000+ lines and 23 columns...3 are formulas, the rest is imported data). I've brought Excel to it's knees (i.e. crashes). Yes, I'm using 2007.

What I'm trying to do is extract 6 cells of data from every 10th line and write it out to a CSV file with two more pieces of information (same for each line).

What I was doing was creating a separate worksheet for each one to be extracted, parsing out the data, and then copying that data to yet another workbook that was then saved as a CSV.

First, in retrospect, that was a waste of time. Second, the addition of the extra worksheets to do the parsing was crashing Excel due to the extreme size of the workbook.

What I'd like to do is use a macro to do all of this in one swell foop:

1) Prompt me for a file name (or I can put the desired name in a cell and read it from there if that simplifies the code)
2) Open a new text file with that name and ".csv" extension in the same folder as the original workbook
3) Write out the column headers: (Fix, Satellites, Lat, Lon, alt (ft), Date, utc_t, course)
4) Step through each row, looking at the text contents of column B (looks like 22:50:07.100)...if it ends in ".000" do the following:
4a) write "PPS,4," to the open text file
4b) write the cell contents from columns "V", "W", "J", "C", "B", and "L" to the text file in the exact format they appear in the text cell.

The output file should look like (very short example):

Fix,Satellites,Lat,Lon,alt (ft),Date,utc_t,course

View 9 Replies View Related

Parse And Import Text File

Jan 29, 2007

I have a software application that imports audio files and writes information about these files to text files. I'm trying to write and Excel/VBA application that will parse and import the data contained in these files. find a sample of one of these files attached. The big hurdle I am facing is I cannot figure out how to parse this file - the delimiter keeps changing as throughout the file (see example below):

otrk ptrk
otrk ptrk
otrk ptrk
otrk ptrk
otrk *ptrk "
otrk ptrk
otrk ptrk
otrk ptrk
otrk ptrk
otrk ptrk
otrk ptrk
otrk ptrk
otrk ptrk
otrk ptrk
otrk ptrk

View 5 Replies View Related

Macro To Parse And Open Text File

Apr 2, 2007

1. Open a text file from a directory on my computer
2. Feed the data into a Excel spreadsheet
3. Parse the text from the text file into columns

an example of some of the stuff in the text file (its all fake btw ),,,
J2MARTIN,20/08/1999,8:57:27 a.m.,
J2MARTIN,20/08/1999,8:57:27 a.m.,
J2MARTIN,20/08/1999,8:57:29 a.m.,

Is it possible to feed all this data into excel into seperate rows and then start parsing it into columns of

IP Username Date Time KbUsage URL

View 2 Replies View Related

Parse Flat File And Enter It Into Separate Cells

Jul 12, 2012

I receive a flat text file every week which I would like to grab with excel and extract only the data I need and enter the data into separate cells and loop until I reach the end of the flat file. I got a subroutine written that allows me to open my text file and it will enter all the data however I need to know how to parse only the stuff I need and enter it into the right cells and loop until I reach the end of my text file. Here is what I have so far:

Sub testFSNew()
Dim fs As Object ' scripting.filesystemobject
Dim txtIn As Object ' scripting.textstream
Dim strFile As String 'File Name
Dim strLine As String 'Current line being read.


Now so far this opens the text file and dumps all the data into an excel spreadsheet however when I say all I mean it dumps everything into the first cell and does not separate it, the following is an example of the text in the flat file. I will only put in the first 5 rows because their is 5000 rows in the real file.


001010000366175270012008085197804171984102919730621DOE BJ52702B25713700000000016005

00101000036617JOHN 109080 55512345671978093000000001MACHINE REPAIR 4

001010000997885270002010384198910301989103019891030SMITH DS52501C257077S0000000000005

00101000099788ROBERT 109109 55523456781999082700000001ELECTICIAN-PROJECT COORD 4

Ok so the first problem is I don't need the first line it's a header line and if you will notice everyline of the file ends with either a 5 or a 4 but it is information about each employee, so the next line would end in a 5 and that would be the beginning of the next employee.

P.S. I noticed in the preview post that this message board truncated my flat file data, so keep in mind that each line is indeed 1 line ending in either 5 or a 4

View 9 Replies View Related

Parse Only Specific Data Of Text File To Worksheet

Aug 30, 2006

I have a text file with no discernable format ( can't import into excel) that is too large to put all the data into an excel worksheet. This file is made to print out on a network printer.

I don't need all the info in the file, I would like to specify a variable, search the text file for the variable, then specify the amount of rows down to look for the data value and input the result into an excel spreadsheet.

View 3 Replies View Related

Parse Text File To Provide Specific Table Like Format

Jun 10, 2009

I need help urgently for parsing a text file to have a specific format. The text file is of format mentioned below: ...

View 9 Replies View Related


Aug 12, 2008

I am making a report that puts out a CSV file my trouble is that some of the numbers are converted to date when they are opened in excel. This report is sent out company wide and I need a way to keep the numbers from changing to date. I have added a tic(') mark to the front of the number but it comes over as '12308. What can I do.

View 9 Replies View Related

Output Csv File

Jul 1, 2006

I'm wondering if it's possible to use a button in excel where I can output a cvs file (from another sheet in the file) with just a click on that button.

View 3 Replies View Related

Save Output To A .txt File

Apr 23, 2006

I have a text file output from a program that is named ABC123.exp. I open up the file with Excel and after manipulating the data with VBA code which includes identifying the Source Path directory(strSourcePath As String ) and the File name (strFileName As String) I want to be able to open up a 'Save As' Window and save the manipulated data into the same Source Path directory(strSourcePath) with the File Name being the prefix of the original with a suffix .txt extension. Ex: ABC123.txt instead of ABC123.exp and the Save as type: Text (Tab delimited)(*.txt). This way my original data wont be overwritten.

View 5 Replies View Related

Read Pdf Or Doc File Line By Line And Then Parse Data Into Proper Cells And Rows?

Feb 23, 2013

I have the data to import / read in a pdf, in a doc, or in an Excel worksheet whichever is easier to use. I need to import the data, parse it into the correct cells for that row and then repeat the import until the end of the file. Not all the cells are in each group of data to import, so those cells will be null for that row. Some of the data for one cell may be in up to 14 lines in the data file. I have be concatenating these data rows into one cell. There are 48,000 lines in the file to import or I would do this manually. I am assuming that doing this in VBA would be the most efficient method.

View 11 Replies View Related

Output Redirection From BAT Or VBS To Text File

Jun 26, 2014

I am working on a VBA routine that calc and verifies hash files for a series of folders and sub directories, using a command line prog called exactfile.exe ( It is very similar to M$'s FCIV utility, but it is actually supported on Win7/Win8. The issue I am having is that I cannot get the standard output/error/console stream to redirect to a text file. I've written the routine multiple ways, trying to figure out redirection. I was using this site

HTML Code: [URL]....

as a reference.

Here is my VBS approach. This code is dependent on another sub passing folder_name as a string

[Code] .....

The VBS then executes using wscript, however, since exf.exe does not return an exit code the same way FCIV.exe does, I need the results redirected to a text file. The results vary from a single line saying "No errors." or multiple lines indicating which files do not match their original hash.

Here are a couple iterations of my BAT approach, where i use the BAT to call the VBS. I really thought I would be able to use the standard redirect > here, since the executable is launched using cmd.exe, but I've not gotten the results I want.

[Code] .....

I've scoured more pages than I can count, but no approach seems to work, so far.

View 4 Replies View Related

Output Property To Save As File

Jun 5, 2006

I'm trying to display some result in my sheet and I don't go further of the MsgBOx use. see my vba code

Dim xslt As New MSXML2.XSLTemplate40
Dim xslDoc As New MSXML2.FreeThreadedDOMDocument40
Dim xmlDoc As New MSXML2.DOMDocument40
Dim xslProc As IXSLProcessor
Dim paramxml As MSXML2.DOMDocument40
xslDoc.async = False
xslDoc.Load "c:compara.xsl"

If (xslDoc.parseError.errorCode <> 0) Then
Dim myErr
Set myErr = xslDoc.parseError
MsgBox ("Ha um erro " & myErr.reason)
Set xslt.stylesheet = xslDoc
xmlDoc.async = False
xmlDoc.Load "C:Instructional_program.xml".................

View 2 Replies View Related

Output Used Range To Text File

Oct 9, 2007

I would like to output the text I perpared in " sheet 1" into a text file, "output.txt"

The imformation I like to output start from coulmn C, and column D then column E.....
The numbers of rows in each column could be different, and also there may be some single empty column in between. The totals numbers of coulmn is unknow.

the text in the output.txt should contant all the imformation in the sheet started from column C, coulmn D, column F.... (if coulmn E is empty). and the text in the output.txt file is continues with no gap in it.

To make it even more powerful for later use, The column that begin with NOT should not be output.

Excel Data-


View 4 Replies View Related

Edit Change And Output A Text File

Feb 7, 2009

I use excel to read in an ASCII data file in which every line beginning with H is a header line and lines beginning with S are data line.

I want excel to filter out the header lines and output the file with the data lines only then outputs these in a new file.

I also want it to read the values from column 72 to 75 and subtract 6 from them then output them again to the same new file.

Sub read()
Open "d:/intouch/0502SPSS.LOG" For Input As #1
Dim i As Integer
Dim lines(9999) As String
i = 0
Do While Not EOF(1)
Line Input #1, z
i = i + 1
If Mid(z, 1, 1) = "H" Then
i = i - 1

ElseIf Mid(z, 1, 1) = "S" Then.................................

the problem is that the new file is generated but it is always empty

View 9 Replies View Related

Output To CSV Text File Produces Extra Spaces

May 21, 2008

I'm outputting some cells to a CSV. At first I tried using the SaveAs function but that renamed my worksheet and didn't work for ranges (as far as I know)

Sub Export()
Dim myADPFile As String
Dim x As Byte
x = 5
Open myADPFile For Output As 1
While (Not (Sheet3.Range("A" & x).Value = NA))
Print #1, Trim(Sheet3.Range("B" & x).Value), ",", _
Trim(Sheet3.Range("C" & x).Value), ",", _
Sheet3.Range("D" & x).Value, ",", _ ..........................

The values are correct. However, the excess amount of spaces is not. Using the Write function just encases everything in quotation marks. Replacing spaces isn't a good solution because the first row MUST be in that format, and removing all spaces would require more code to put spaces back in. Is there a way to get rid of all the excess spaces surrounding each value?

View 2 Replies View Related

Loop Through Rows With VBA And Select Output File With Selectable Dates

Apr 9, 2014

I have developed a user form in VBA which is used for entry into an excel worksheet. From this data, I need to do the following:

1) Create 2 output files for Job data entitled "J" and another file entitled "S". The "J" and "S" is captured in a field in the data. I need to hit a button that allows these 2 output files to be produced, so I need to 'loop' through rows of the data to do this/

2) In addition to 1), the user needs to be able to 'select' the date range they would like to see 'J' and 'S' data over. This will be based on a field called "Startdate'. How could I do this with the button above-can I parse an input value to a form and select the 'J' and 'S' files on this.

View 1 Replies View Related

Excel Macro To Output Text File After Global Find And Replace

May 19, 2014

See attached image.

So what I am looking for is to put a macro behind button 1 which will do the following

Enter A Default Value Of 123 In The Yellow Boxes (B7:K7)
If They Are Blank When The User Clicks The Button
Performs A Search And Replace To Replace The Values 01-01-1990 With B8, 02-01-1990 With C8 Etc Until K8
Output The Contents Of Sheet 2 To A Text File (In XAI Format) In The Following Order A1:A100, B1:B100, C1:C100

[Code] .........

View 1 Replies View Related

Parse A String?

Jul 13, 2009

If I have a cell that has the following information: DEF(352) HHY(24533) KLDD(3334)
And I extract that to a String with the following

View 3 Replies View Related

Parse By Numbers

Mar 18, 2008

I have about 10,000 records which I need to split up into different fields, they are in the format prescribed below:

1 George Avenue
20-25 Alphingoton Close
Manors House

I want the above to be in this format:

Collumn 1 Collumn 2
1 George Avenue
20-25 Alphington Close
Manors House

View 9 Replies View Related

Read And Parse

Aug 9, 2006

Raw data:

1 acct01 John Doe 10
2 acct01 Hits 20
2 acct01 Runs 05


1 acct01 John Doe 10 20 05

View 3 Replies View Related

Parse XLM To Worksheet

Jul 25, 2007

Searched answers but found nothing that helped. The following code results in the error - 1004 Reference is not valid. First cell is not empty and not the same as select.

' Sorting
On Error Resume Next

oExcel.Selection.Sort oExcel.Range("C2"), xlAscending, , , , xlSortNormal, xlSortNormal
If Err.Number > 0 Then
WScript.Echo "An Error Occured: " & Err.Number & " " & Err.Description
End If

View 6 Replies View Related

Parse After Each Dash

Aug 9, 2007

I work in the Oil and Gas industry and deal with large data tables that have "Location Codes" for lack of a better term.

The problem is that not all Databases use exactly the same format of code, they will however always have the following:

xx-xx-xx-xx ---> ie. a string of four numbers each seperated by a Dash.

This string sometimes will appear after a text name of varying length. With this in mind I would like to parse the four numbers into four different columns.

Things I've tried with some success:

Using the "Right" function to break off the location code off the end of the entire name, and then using the ".parse" command in VB to seperate the numbers at given intervals.

This is great for certain purposes however because the four numbers are not always 2 digits, and the ".parse" command cuts at given intervals it is hard to accurately parse an entire set of data.

Some examples of location Codes are given below:

WEST DOE 11-16-81-15
KNOPCIK 3-9-73-9

View 9 Replies View Related

Parse Text In Excel

Jun 6, 2014

Trying to Parse text in Excel - Since there is no definitive length and no standard in the way the name is created , I am having tough time to use the Software reports.

A column is from software report,

I am looking for any option to arrive at values as appearing in F column.

I did B and C column but not sure is there any other efficient way of doing the same or any other formula to arrive at F - Desired Result.

View 1 Replies View Related

Parse Out Last Two Words In A Cell?

May 6, 2014

I have a column that is a list of addresses. For example:

I need a formula to separate out the last words (city and state) from the rest of the address and put into a different cell.

View 4 Replies View Related

Parse Contact Names

Aug 22, 2007

I have an unusual request this time. Client wants this and I know it's dumb but this is what they need and I can't figure it out (not smart enough ).

They have the following as contacts in column A:

Belinda Jones & Grant Smith
Ken & Marie Johnson
Bart Simpson

They need this separated into a Contact 1 and Contact 2 so that it ends up like this:

Contact1 Contact 2
Belinda Jones & Grant Smith
Ken & Marie Johnson
Bart Simpson

This is a list of 10,000 names and I have no idea.

View 9 Replies View Related

Parse Data Between 2nd And 3rd Delimiter

Apr 21, 2009

I'm looking for a worksheet function that will allow me to separate into another cell the characters between the second and third slash in the source cell. The number of characters varies, but the value I want is always between the second and third slash.

View 3 Replies View Related

Parse XML String - Pull Out Value In Between

Aug 7, 2012

Basically I have xml strings that are pulled out of a database all in the same format as below.

In between the 2 pharses below I need to pull out the value in between

For this example it is N.

A1<?xml version="1.0" encoding="iso-8859-1" ?>
<Stu2<?xml version="1.0" encoding="iso-8859-1" ?><StudentPersonal_XML><BirthToThreeServices>

View 3 Replies View Related

Parse AlphaNumeric String

Apr 8, 2013

Objective: To create a list of numbers based a cell which are present in an alpha-numeric string

Issues: "-" shows up at times without the context of numbers (i.e. MS-DRG)
Issues: I am not interested in float numbers (i.e. 37.63-37.66)

'Example data in cells (row 1 = A1, row 2 =A2, row 3 = A3, row 4 = A4)
MS-DRGs 767-768, 774-775
Rev 115, 125, 135, 145, 155, 655-656
Rev 174
MS-DRG 001 with ICD-9 37.63-37.66, 37.52

'Desired Results (row 1 = B1, row 2 =B2, row 3 = B3, row 4 = B4)
115, 125, 135, 145, 155, 655, 656

View 9 Replies View Related

Copyrights 2005-15, All rights reserved