Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBS Script - Sorting & Grouping data in a CSV File

Status
Not open for further replies.

NickC111

Technical User
Sep 23, 2010
44
GB
Good Morning

I would some help with a CSV File, the file has three columns and over 10000 rows.

The first column is a claim number, second is a cell number and the third column is a value.

I want to be able to group the data by claim number but the claim number may appear more than once.

If possible I would like the data to appear as follows:

1212121215,11,545.25,12,454.25,13,25.23
3232323233,11,253.25,13,56.00

Not every claim number has a value in the cell number

I attach a sample of the csv file I have
 
you may find excel can do something for you out of the box?

if not then i would suggest:

+ create a dictionary object to contain your informatipn
claim number = dict.key, cellnum and value = dict.value
+ read the csv file line by line
-check to see if the claim number already exits in dictionary
+ add it if it doesnt, with the dict.value = current lines remainder
+ if it already exists, then append dict.value for that claim number with the remainder of current line

+ close the file
+ enum the dictionary writing a new csv file

I Hear, I Forget
I See, I Remember
I Do, I Understand

Ronald McDonald
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top