Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > Sort and Calculate .txt file (Daily Flows)


Reply
 
Thread Tools Display Modes
  #1  
Old 06-06-2012, 09:43 PM
tienxviet tienxviet is offline
Newcomer
 
Join Date: Jun 2012
Posts: 1
Default Sort and Calculate .txt file (Daily Flows)


I'm trying to sort and calculate a huge text file.
I'd like calculate the daily flow by month/year first.
and then also for Annual along with the station code.
I think you'd have to skip the first 17 lines to begin reading the data.

For Ex:
Station Code Month Flow(cfs) Annual Flow(cfs)
02429900 June 1973 ----- 1973 ------
02429900 July 1973 ----- 1972 ------
etc.

I've attached the text file.
But here's some of the file. (Disregard the A and Ae)

USGS 02429900 1973-06-01 21 A
USGS 02429900 1973-06-02 19 A
USGS 02429900 1973-06-03 17 A
USGS 02429900 1973-06-04 16 A
USGS 02429900 1973-06-05 15 A
USGS 02429900 1973-06-06 30 A
USGS 02429900 1973-06-07 26 A

Anything will be of help.
Thanks
Attached Files
File Type: txt BIG BROWN CREEK NR BOONEVILLE.txt (346.2 KB, 1 views)
Reply With Quote
  #2  
Old 06-07-2012, 02:52 AM
TheRealTinTin's Avatar
TheRealTinTin TheRealTinTin is offline
Junior Contributor
 
Join Date: Nov 2008
Location: Glasgow, UK
Posts: 328
Default

Hi tienxviet and welcome to XVBT.

The text file you supplied only had little over 11,000 records so not big. Do you have MS Excel? The easiest method would be to open the text file in that and use the tab delimited option, that will pull through into columns and then you can use the normal sort functionality within Excel. Or are you looking to automate the process?

If the latter, you could record a macro while importing the data and then you will be able to use that macro each time (provided the file name is the same each time).

You could of course go further and add in your own code that allows you to choose a file and where you want it imported to etc. but given the size of the data and the time it takes to import it manually (no more than 10 secs), unless this was a repeating process throughout the day, I don't see any advantage in doing it this way. Of course, the choice lies completely with you however.
__________________
Artificial Intelligence is no match for natural stupidity
Reply With Quote
Reply

Tags
calculate, daily flows, sort, vba


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->