General discussion

Locked

How to sumarize data from a csv

By cornejo.alvaro ·
Hi

I need to extract data from a csv file. The file contains 8 csv columns. I'm interested in getting info from only 3 columns: the one that has a name the one that has the product ID and the third that has the quantities sold.

I'll need get a summary of it, for each sales guy how much does he sold for each product.

I've messing around an script but being unable to have something that work. I've been able to filter the 3 columns but have been unable to have the sum of quantities of each product per salesguy.

Any ideas?

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by Miss Kitty In reply to How to sumarize data from ...

How are you working with the file? The easiest way to work with a csv file is to import it into Access and then filter your data with a query. Then you can pull it into excel or word to get the summary.
Cathy

Collapse -

by cornejo.alvaro In reply to How to sumarize data from ...

Hi

as the file is quite small <100 lines, I open it with the ADO and get the data. Also I need to do this once every month.

Collapse -

by thumbknuckle In reply to How to sumarize data from ...

Why not import it directly to Excel, and have the columns with irrelevant data hidden? No scripting or filtering needed.

Collapse -

by hain In reply to How to sumarize data from ...

You should import the csv-file into Excel an use the "Pivot-Table"-Function. This will give you the needed summary instantaneously.

Hain

Collapse -

by Tony Hopkinson In reply to How to sumarize data from ...

If you can get it in to a DB,(ODBC Text driver ?) so SQL is available then the query would be something like
Select SalesMan,Product, Sum(Value) as "Total Sales"
From Sales
Group By Salesman,Product
If you are operating on the raw file in a scripting language, then you've got a fair bit of code to write to reinvent this particular wheel.
The OO way would be to create a collection or list class with an add method that took the three values
If Salesman/Product didn't exits add a new item and set the value otherwise find the exitsing and add on the value.
then sort and then display however you are going to do it. As others have said access or excel would do this with a macro and the csv file as parameter and it would save you reiventing this particular wheel.

Collapse -

by cornejo.alvaro In reply to

Poster rated this answer.

Collapse -

by cornejo.alvaro In reply to How to sumarize data from ...

This question was closed by the author

Back to Web Development Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums