Read And Parse
Aug 9, 2006Raw data:
1 acct01 John Doe 10
2 acct01 Hits 20
2 acct01 Runs 05
Goal:
1 acct01 John Doe 10 20 05
Raw data:
1 acct01 John Doe 10
2 acct01 Hits 20
2 acct01 Runs 05
Goal:
1 acct01 John Doe 10 20 05
I am trying to determine a way to quickly import data from text files into Excel and place data in suitable columns (under correct headings). I am thinking I could be asked which file to read and import doing them 1 by 1, or if there is an automated way to cycle through all the files that would be more efficient (filenames are variable).
From the text files I have attached I can tell the column headers and what data should go under each. Not sure how you would describe the delimiting on these files? Are these files in a format that VBA could be used to reduce manual copy and paste approach? I have about 300 of these files I want to extract the data from.
Note: the attached files are from a public access website.
WELLS0214.TXT WELLS0106.TXT
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 RelatedI'm trying to open a file on a network drive...but I'm getting the following error message when it opens: "This file may be read-only, or you may be trying to access a read-only location. Or the server the document is stored on may not be responding." Now, the file itself has no rights restrictions and is not read only. It doesn't appear to be locked.
Now, there are other Excel files in the same directory which I could open fine; however, the Excel documents having the above problem all have a little black icon "appears to be a padlock" (image attached) at the bottom left hand side of the Excel file icon. I tried the following:
- Renaming
- Converting to a different file format (didn't work, it won't let me)
- Opening in notepad...etc doesn't work.
This file is dated back in 2004...do you think it's corrupt? Is there anything i can do to open or recover this?
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
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
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
oExcel.Columns("A:G").Select
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
Err.Clear
End If
oExcel.Range("A2").Select
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:
9-23-78-11
WEST DOE 11-16-81-15
KNOPCIK 3-9-73-9
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.
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.
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.
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 RelatedBasically 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" ?>
<StudentPersonal_XML><BirthToThreeServices>
</BirthToThreeServices><EarlyInterventionParticipant>N</EarlyInterventionParticipant>
<LateReferralOther></LateReferralOther><LateReferralReason></LateReferralReason>
<Stu2<?xml version="1.0" encoding="iso-8859-1" ?><StudentPersonal_XML><BirthToThreeServices>
</BirthToThreeServices><EarlyInterventionParticipant>Y</EarlyInterventionParticipant>
<LateReferralOther></LateReferralOther><LateReferralReason></LateReferralReason>
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)
767,767,768,774,775
115, 125, 135, 145, 155, 655, 656
174
001
I need to parse text strings and format them.
The string looks like this and runs down an unknown number of rows in one column, Col A.
+000800-000900+00123456-000800+0012345650+000700
I want to parse this so that the results will be text to columns
80.0 90.0 1234.56 80.0 1234.56 50 70.0
I want to thank BrettH for creating this VB. I want to manipulate it to read every row in Col A that has data, and then I want to parse the data as shown above. BrettH's VB works but I couldn't modify it to read all the rows that had data. I tried looping the rows using a counter loop and also a For Each loop, but could'nt get it to work.
Sub ParseInCellMath()
Dim DefaultRange As String, UserRange As Range, OrigForm As String
Dim TempForm As String, NegString As String, NegStart As Integer
Name They are all QC(Quality Control) then Rank
In cell A1:
Anderson, Bob QC, Top Gun
I need in B1:
Anderson, Bob
In C1:
Top Gun
What could I use to get these results? The QC, is consistant every time in each set of text.
Below are the addresses I get in Col H. For sample, just few of them.
GAINESVILLE TX 76240
Covington GA 30014
New York NY 10003
FISHERS IN 46037
BLOOMFIELD HILLS MI 48304
SAN DIEGO CA 92120
Chicago IL 60638
NORTH OLMSTED OH 44070
Toronto ON M9W 5E7
DEL RAY BEACH FL 33484
VALPARAISO IN 46385
MERIDIAN MS 39301
KERRVILLE TX 78028
Galveston TX 77554
FOREST HILLS NY 11375
MONTREAL QC H3A 1B4
As you can see, CITY name can be multiple words, STATE names are 2 Digit letters for both US and Canada, and ZIP Code is Numeric to US and Alpha numeric to Canada. I have all these in a single Column. I need to separate them into Col J,K, and L. I have the following formulae but these don't return exact parsing. For example; my formulas in order:
To parse CITY, '=LEFT(H15, FIND(" ",H15)-1)'
To parse State, '=MID(H15,LEN(J15)+2,FIND(" ",RIGHT(H15,LEN(H15)-LEN(J15)-2)))'
To parse ZIP, '=RIGHT(H15,LEN(H15)-LEN(J15)-LEN(K15)-2)'.
I'm trying to populate a ComboBox or ListBox with elements parsed from a html code I've already parsed from a webpage. Explaining: I was able to extract from the webpage code the part that contains the information I want, which is:
VB:
<li><a href="/universidad/" rel="*">Universidades</a></li>
<li><a href="/universidad/duoc/" rel="28184">DuocUC</a></li>
<li><a href="/universidad/inacap/" rel="28162">INACAP</a></li>
[Code].....
Now I want to make a ComboBox containing every university as a different option and, if possible, to assign them the corresponding values shown in the code.
I have a mastersheet (see attached file) with data on it. I need to parse this data out to individual sheets based on the values in column 8.
Currently I use this code but it only creates sheets with no data in it and it also doesn't rename the sheet tabs.
[Code] .....
Sample.xlsx‎
I will have a cell that has company names in it and I need to parse each name an then do some work with them but when I started this project I was told each company will be seperated by some number of spaces.
Ex.) |Company1(534553) Company2(3544)|
Right now this is how I'm parsing a line like this:
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
I have the following entry in A1
email_yshot_20081222
I want a formula to parse the text based on the "_" deliminator so email is in B1, yshot is in C1 and 200081222 is in D1.
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
PPS,4,30.543203,-86.323328,1419.04,2009/12/17,23:26:22.000,243.95
PPS,4,30.539272,-86.332765,1831.53,2009/12/17,23:26:34.000,242.61
PPS,4,30.535680,-86.340912,2281.16,2009/12/17,23:26:44.000,244.34
I have data that I copy from one sheet and move it to another. If I know I'm parsing data that may vary in amount of line items but will always be across 3 columns is there a way to parse this data evenly.
for example:
I would like to look in column "D" and if there is an "A" I would like to parse cells A,B,C in that row to sheet 2 and parse this information evenly across 3 columns evenly across columns "A,E, I"
In my example the data is only 21 rows of information the problem I have is evenly parsing this information.
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 .............
A while back I asked how to remove the letters from entries that have both numbers and letters. I as pointed to a UDF called "ExtractNumber".
Here is the code for that UDF: .....
I want to parse a cell if a date is present for example I have 03/26/1985 AL in one cell and want to parse to two different cells however in between those cells I have other cells with different data that I dont want to parse. Basically I need to parse the cells only if a date is present.
View 7 Replies View RelatedI 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
I was wondering how I would go about witting a vba for that can be connected to a button which would allow me to enter a row of input.
Some of these values I would like entered for example are: Quantity, Shape, Weight, length....
I would like the user to be prompted to enter these values and then have these values entered into columns, ABC... in a row on the spread sheet.
The catch is I would like this new date to be entered on one sheet via its weight (so that lightest material is on top), on another sheet in this workbook entered via its location so material in the same locations are adjacent to one another, and then finally I would like this updated onto another worksheet.
I receive a text file daily of between 100 to 50,000 rows. It is a combination of many smaller text files or " records". Each record contains a row containing the name and some particulars . From 1 to 5 rows below that row there may or may not be a row containing the score for that record.
Here is an example of what the rows look like;
4505329 64036593 150090 MS MARY SMITH AB Finished
CRP 3.0 SCORE: 400
From the first row I need to pull out the second string of digits (ex 64036593) and the person's name. From the second row I need to extract the score (400). I would like to copy the three pieces of information to 3 separate columns on another sheet.
Comments
1. the word "Finished" always appears at the end of the row with the name in it but it also appears at the end of every record in it's own row like this;
Finished No Note
2. the strings of digits in the first row can vary in length but there are always 3 of them and they are always seperated by spaces.
I need to extract all the names and scores and put them in a table. If a name is not followed by a score I need to put "no score".