Calculate Sum From Text Files

Nov 14, 2009

I have thousands of lines in a txt file and would like to total the sum of a field. here are the few lines in the txt file.

I would like to calculate the LPG_Amt for each of the Company_code and the count of number of lines for each of the Company_code. Request the members to help me with a vba code that could run in an excel file and give the output in excel.

Company_codeShip_to_PtLPG_Amt
DK01100281757,454
DK011002817620,630
DK011002818012,929
DK011002818121,783
DK011002818324,470
DK011002818512,478
DK011002818621,692
DK011002818714,424
FI011002872728,708
FI011002873122,114
FI011002873237,827
FI011002873362,425..................

View 9 Replies


ADVERTISEMENT

Save Ranges In Multiple Files To Text Files

Dec 21, 2007

I have a excel file that I enter information into. I have code that saves the files to a certain folder with the name, date, and time stamp for the file name. At the end of the day I might have 3 to 15 excel files I have created that day and I would like to take information from certain cells (examle: L3, B6, B7, B8, G8, and so on) and create a txt file with all of the information in it.

Example:
12/20/2007
Your Name
123 Somewhere St.
Here, OH 45111
Home Visit

12/20/2007
Someone Else
345 Anywhere St.
There, OH 45211
Hospital Visit

View 9 Replies View Related

Convert Multiple Files To Text Files

Sep 26, 2007

I have about 100 Excel files in one folder that need to be saved as text files. They can keep the same name, but simply need to be converted to text files. I'd like to use VBA for this and I can't find examples that do exactly that...or ones that my limited knowledge can handle.

Excel files exist in C:Source and ALL of them should be saved as text files in C:Destination. Maybe there is an easier way, but I thought for sure there was a routine I could use.

View 4 Replies View Related

Disable Calculate Formulas That Link To Other Files?

Oct 21, 2011

I got a workbook that is linked to many external workbooks and it is very slow to calculate, so I work it with manual calculation and only calculate the sheet (SHIFT+F9) when necessary. To work with this workbook I need to be able to make faster manual calculations. I have tried many solutions and the only one that seems to work, is to work without the links to the other files (by breaking the links and turning the formulas to values). The problem with this solution is that I can't lose the formulas. I think that must be a way to calculate the sheet without calculating the cells that got a reference to the external files. Only the formulas in the current sheet.

View 3 Replies View Related

Write Ranges To Text Files & Save Each As Cell Text

Sep 17, 2007

I m trying to write a macro which could take the text from a single column row T2 to row T313 and write it to a .txt file. Have the .txt file name created by the text in T4 or I could also put the text to name the file in T1 if you think it would be easier.

Then carry on to the next named sheet and produce another .txt file in exactly the same way until all 15 sheets have been completed. It would also be helpful if prior to starting to write each text files, it could test for any text in cell A2 of the sheet. The first empty A2 cell of a sheet would determine the end of the run, if it was prior to sheet 15 being reached.

View 2 Replies View Related

Split Text File Into Smaller Text Files

Mar 15, 2005

I'm trying to take a large text file and break into smaller text size files. I want to open the data file, and parse into 5000 line smaller files.

Here is what I have based off of some MS KB
Sub LargeFileImport()

'Dimension Variables
Dim ResultStr As String
Dim FileName As String
Dim FileNum As Integer
Dim Counter As Double
Dim CounterMax As Double
Dim sPath As String
Dim FileCounter As Double
'Output File

View 9 Replies View Related

Load & Retrieve Text From Text Files In Folder

Apr 24, 2008

how I would go about addressing this issue. I am given a directory with individual files in it. Each file has critical information I have to extract from it. So, I want the user to provided this directory to the macro and I want the macro to cycle through each file in this directory (excluding super and sub direcories), open it, retrieve info, and close it

View 5 Replies View Related

Imported Text Files Numbers Seen As Text

Mar 10, 2008

I have opened a .txt (by right clicking and selecting Open with rather than open from within Excel) file with numbers using the format 1,234,567.00 but in my country we use 1 234 567,00. So I created a macro changing the , into "" and the . into , and it works fine while creating the macro itself (by using the macro recorder) and the numbers shows and behaves like numbers. However, when running the macro on a new file some numbers remain as text whereas others are numbers. Theres is no common string, eg that numbers starting with - (minus) remains text.

It does then not matter if I go to the format function and select number with decimals and thousand dividor - the number still remains as text. I have also tried the suggested multply by 1 but it still remains as text. The only thing that helps is to either double click on the number or use the Konvert text to number. But I would then have to click each number in the whole table which is what I wanted to avoid.

View 7 Replies View Related

Text Files Sorting

Jun 23, 2008

What I have is a bunch of text files and 2 spreadsheets that sort the text files. I’m not sure but I think there might be a better way but the problem is I don’t know VB all that well. Can someone take some time and look over this stuff and let me know if there is actually a better way to make this happen. I also noticed that there are 2 txt file missing and not added in the sorted file (PS3_HIGH, PS3_URGENT)

The text files come from another network and are transferred manually every day to a folder. The purpose of the .xls files is so that someone can look at the counts and try to lower the numbers from day to day. If something is alarming frequently, the current files do not put that information together well. The numbers are still important, but is there a better way to do this sort in excel?

View 9 Replies View Related

Aggregate Text Files

Jul 2, 2009

To go through all the database files (.txt format) in a designated folder in order to update an Excel Sheet with the required information from those database text files. Then to summarise the information in a simple table.

The text files are individual Market Exports from a game I play, and are titled as "Region-ItemType-YYYY.MM.DD HHMMSS.txt"

eg. "Heimatar-Tritanium-2009.07.02 133353.txt".

I need to know how to sift through the text files to find the most recent one with matching "Region-ItemType" parts in the file name, and refresh the Excel Sheet with the updated data.

After that, I need to be able to combine all of the cheapest sale prices for each item, with a minimum amount for sale (differs per item), while also being limited to location the item is being sold at, into a single sheet of the important information I wanted to extract in the first place.

At the end of the whole process, I need to have a single Excel Sheet with every different item's lowest price for each different place, displayed in a table I can use to make formulas from.

So if I have an export from a place called "place1" and one from "place2", looking at the same item called "item1", I should have two rows of tabulated data, one for each place's lowest price. And this should update at the touch of the "Refresh All" button, or... However you'd have to do it

I have attached a copy of one of the database text files.

View 11 Replies View Related

Worksheet From Text Files

Dec 11, 2009

Hi all, first up I'm a total novice but I'm trying to populate a worksheet from a text file, but here's the kicker, I'd need specific lines of the text file to populate specific columns.

None of the text files will contain the same data, but, they will all have the same related data on the same lines. So I'd like to see:

.txt file 1 line 1 > Worksheet A:1
.txt file 1 line 6 > Worksheet B:1
.txt file 1 line 12 > Worksheet C:1

.txt file 2 Line 1 > Worksheet A:2
.txt file 2 Line 6 > Worksheet B:2

etc.

Everything needs to go into the same worksheet. Some .txt files won't have any data in the specified lines so skipped if blank, or just blank data copied.

I need to run through about 1300 .txt files in a directory in this fashion, can it be done?

View 14 Replies View Related

Importing Text Files

Sep 25, 2002

I have a whole lot (hundreds) of .txt files that contain fixed width data that I need to convert to Excel format. I can open each file and step through the Text Import Wizard, then save it as an .xls file, but I'm wondering if there's a way to convert all the files in a given folder from .txt to .xls without having to open each one while (here's the kicker) still placing the data between the spaces on the .txt file into individual cells and columns like the wizard does.

View 9 Replies View Related

Exporting To Text Files

Apr 27, 2007

I am gathering data over several sheets and need to export it as a.txt file.

The problem is that in excel the data reads 1,2,3,4 and when I export it or save as or open and paste to the resulting data reads "1", "2", "3", "4,".

How to I get the txt file to not have the ""'s?

View 9 Replies View Related

Comparing Text Files In VBA

Dec 3, 2008

I have two text files with huge data in each which I need to compare for difference between each
for e.g.

file 1 would have following records

12345 KKKK 3510 ABCD

file 2 would have
12345 KKKK 3210 ABCD

file 2 would have similar records but 3510 would have difference. What i need is " if 12345 and ABCD is matching then what is the difference value of 3510 and 3210 ? the result should be 300 . This i need as an output in another text file.

View 9 Replies View Related

Search In Text Files

Sep 15, 2009

i have a txt file see attached and i need macro to:
1)open the file
2)find the word "Dimension no: 3"
3)go 2 lines dwn and copy the number " 64.999"
4)paste it into excel

file:me.txt
Dimension no: 1
Plane:PL1
Flatness 0.003 0.200 *---
--------------------------------------------------------------------------------
Dimension no: 2
Circle:CR1
Diameter 113.001 113.000 +0.000 +0.300 0.001 *--+---
--------------------------------------------------------------------------------
Dimension no: 3
Circle:CIR0
Diameter 64.999 65.000 -0.300 +0.300 -0.001 ---*---
--------------------------------------------------------------------------------
Dimension no: 4
Plane:PL1--Plane:PL3
Lengthavg 15.500 15.500 +0.000 +0.100 -0.000

View 9 Replies View Related

Using Text Files Vs Workbooks

Sep 3, 2006

What is the need for storing information in a text file instead of just keeping the data in excel on a worksheet or in vba code.

for example.

I have a file that was given to me that on the OpenWorkbook event runs through an "INI read " procedure. All this does in get certain data from a text file such as:

file paths, rates, file names

Is there any need for this as you could easily store the same information on a worksheet and declare variables in the code.

View 9 Replies View Related

Stripping Cr/lf From Text Files

Feb 8, 2007

I have a text file that has been saved via PL/ SQL code from a CLOB (due to the MSDAORA not supporting CLOBs). Unfortunately, due to passing the file between operating systems it appears that the CR and LF characters are not consistent. This means that my third party application in Excel cannot read the text file properly.

View 2 Replies View Related

Convert Multiple Text Files To CSV?

Jul 17, 2014

Below code Works for TAB delimeter but if there is ' ,' in a row its not reading correct data.Basically I am trying to read multiple .txt files to .csv .

Sub txt2csv()
Dim Fname As String, ipath As String, retstring, fs, a, i As Long
With Application.FileDialog(msoFileDialogFolderPicker)

[Code]....

View 2 Replies View Related

Importing Very Large Text Files

Oct 28, 2008

So I am trying to use this VBA:

http://www.cpearson.com/excel/ImportBigFiles.aspx

It´s basically so I can important a very large log file, about 800,000 lines, many of them repeating, I want to import into Excel to better control the data.

I keep trying to import the data, and I cant get it to make me new sheets.

View 3 Replies View Related

Remove Files Contaning Text

Sep 26, 2009

Im trying to loop through all the files in the folder. and look at the filename if the filename contains JPE_s.jpe delete the file.

View 14 Replies View Related

Split Text Files In Folder

Aug 29, 2012

I have several txt files in a folder, say FileA.txt, FileB.txt, etc.

They exceed 1 million rows so I would like to split them, create FileA_1.txt, FileA_2.txt, etc. FileB_1.txt, FileB_2.txt, etc. and store them newly created files in a different location to the original files.

View 1 Replies View Related

Macro For Importing Text Files

Jan 16, 2014

Below is a macro I recorded for importing the text file AJ9285 into excel from an external location.

I would like to modify it so that excel will give me a prompt and I can type the text file name in.

Sub adt()
'
' adt Macro
'
'
With ActiveSheet.QueryTables.Add(Connection:="TEXT;Z:AJ9285.ADT", _

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

View 2 Replies View Related

Open Multiple Text Files

Mar 9, 2007

the VBA code to allow a user to navigate to any of our network directories and upon selecting (using workbook getopenfilename hopefully) the proper folder on their directory open each txt file (delimited with a pipe) and then save the active file as a xls file and then close it and move on to the next file. I am pretty sure this will take a do while statement but I am not sure how to write it.

View 9 Replies View Related

Importing Multiple Text Files

Apr 16, 2008

This is a great bit of code (I found), to import multiple text files.

I have one small issue -

currently it imports with each file going to a new column, like this: text file1 A1:A4, txt file2 B1:B4, txt file3 C1:C4 etc etc

And eventually i risk running out of columns because I'm working with a lot of text files.

Can someone tell me what to do to modify this code so it imports like this? :
text file1 A1:D1, txt file2 A2:D2, txt file3 A3:D3 ETC ETC

.e.g. first file imports across row1, second file across row2 etc


Sub test2()
Dim myDir As String, fn As String, ff As Integer, txt As String
Dim delim As String, n As Long, b(), flg As Boolean, x, t As Integer
myDir = "\BP1MELIS001SHARED_DATAEVERYONESolutions IntranetPriceMasterlogs" '

View 9 Replies View Related

Transposing Delimited Text Files

Dec 18, 2008

I am working with Excel 2003 which has a limit of 256 columns. I often import text files into excel using a very simple macro. I specify the text file's name and location in a cell and then run the macro - it opens the text file, copies the data and pastes it into the worksheet, then delimiting the columns using the semi-colons that seperated the data in the original text file.

However, I now have a text file that would convert into excel as around 1,000 columns and about 20 rows. This obviously causes a problem since my limit is 256 columns in Excel 2003.

Is there any way that Excel can transpose my data when it brings it into the spreadsheet from the text file so that I end up with 20 columns and 1,000 rows? Ideally I'd do this in VBA and add the code onto my existing little macro

View 9 Replies View Related

Extract From Multiple Text Files

Aug 17, 2008

I have about 50 - 60 text files and I need to find certain values, namely Name, Account No, total amount under Portfolio Value in the text file and copy these values to a worksheet under column: Name, Account and Portfolio Value respectively. All new entries are paste one row below the existing data.

Some of the text files may not have any data in it or may not have the Portfolio Value as the monthly transactions may occupied 2 or 3 text files. Some text files may have 2 Name in it and there will be 2 Portfolio Values in it which I will need both to be copy to the worksheet.

I have attached both the Excel file and the dummy txt file.

View 3 Replies View Related

Importing Large Text Files

Feb 8, 2006

With reference to Importing large text file. i need to get large text files to automatically split across Excel sheets sheets while trying to Import. Can it be done only through Macros or is there any function in Excel itself.

View 7 Replies View Related

Reading Lines From Text Files...

May 23, 2006

I have checked the forum about reading from text files, but I wasn't able to find and similar thread. Here is the situation: I have one text file, but first 204 characters are the file header. 204. character is an asterisk. Then, the records begin. Following is the beginning of the file:

$$GNCSBU/PML/0002 TCPX 11006 IST Bayplan 23.05.06 14:35:57 TRIST 11006 *
And it continues:.....................

View 2 Replies View Related

Code To Import Text Files ...

Jul 17, 2006

I am trying to write a macro which creates a new worksheet with the name kenmerk (i) and then import five different textfiles in this worksheet.

I was wondering how to define the name of the textfiles in the code. The code I get with record macro is: ...

View 6 Replies View Related

Search Value In Multiple Text Files

Jul 29, 2006

I have patent numbers in column A of an excel sheet and would want to locate or search the specific text files (located in my D:Files folder) containing those values. If the value is found in myfile1.txt then the result should be outputted in column B containing the filename of the text file. For example:

Column A Column B
us20061234556b1 myfile1.txt
us20061434455a2 myfile2.txt
wo200612344556A myfile3.txt

View 5 Replies View Related







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