Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 05-07-2002, 06:24 PM   #1
Resident Slacker
 
homer15's Avatar
 
Join Date: Dec 2001
Location: Suisun City, California (i know, where the hell is that?!?!?)
Posts: 2,620
Excel Macro

hey everyone,

i was wondering if anyone would be interested in helping me write a macro. it involves taking comma seperated files, merging them into one excel spreadsheet and sorting them. the two files would be, like cost and revenue, for example. i would like the cost of an object to match up with its revenue, so i can see how much is being spent on something as apposed to its cost, percentage wise. i know the basics of basic, but i don't know how to get it to work in a spreadsheet; but it's probably some simple task that i don't know about. if nobody wants to help, that's cool, but it would be really nice if someone could show me a few tricks or something. if anyone is interested just pm me.

homer
__________________
Friends help you move. REAL friends help you move bodies. - me
quite possibly the best book ever written... by me
homer15 is offline   Reply With Quote
Old 05-07-2002, 07:54 PM   #2
Member (10 bit)
 
David_Jones's Avatar
 
Join Date: May 2000
Location: New Zealand
Posts: 546
Hi,

You could use a macro for this, but I don't think you really need to.

Making some assumptions here:

- This is a regular requirement, not a one off need.
- The files are always in a standard format, and can be given a standard name each period.

If so, then you should be able to query the CSV files directly from Excel, and bring in the data to, for example, two sheets in an 'analysis' spreadsheet.

From there, you could have a third sheet that pulls the revenue and cost data from the data sheets and matches them together.

In reality, you don't HAVE to have the data sheets, but I normally do it that way so that I can pull the data in once, and then just use the spreadsheet file without having links updating (speed / time issue only).

Hope that helps,

David.
David_Jones is offline   Reply With Quote
Old 05-07-2002, 10:53 PM   #3
Resident Slacker
 
homer15's Avatar
 
Join Date: Dec 2001
Location: Suisun City, California (i know, where the hell is that?!?!?)
Posts: 2,620
thanks david_jones.
i do need a macro for it because i'm going to be doing it on a regular basis.
homer15 is offline   Reply With Quote
Old 05-08-2002, 12:33 PM   #4
Resident Slacker
 
homer15's Avatar
 
Join Date: Dec 2001
Location: Suisun City, California (i know, where the hell is that?!?!?)
Posts: 2,620
here's an example of a file i'd use. i know how to get them imported just fine, but beyond that i'm lost. if anyone could help, it would be greatly appreciated. (it's a zipped xls file.)
Attached Files
File Type: zip example.zip (2.7 KB, 24 views)
homer15 is offline   Reply With Quote
Old 05-08-2002, 04:10 PM   #5
Member (10 bit)
 
PMich's Avatar
 
Join Date: Jan 2001
Location: Greenville, MS
Posts: 625
I quit writing excel macros a while ago because it is just as easy to record them. Go to tools--> Macro --> record new macro. Once you have begun recording the macro do what you need to do by hand and then stop recording when you are done. You may need to do a little tweaking to get it just right but I still think its quicker than writing them. Besides, you can go back and view the script associated with the macro after you have recorded it and learn the commands that way. That was how I learned, but I eventually abandoned writing for recording for most things.
PMich is offline   Reply With Quote
Old 05-08-2002, 04:26 PM   #6
Resident Slacker
 
homer15's Avatar
 
Join Date: Dec 2001
Location: Suisun City, California (i know, where the hell is that?!?!?)
Posts: 2,620
thanks PMich

there are some things that i'm asking that i know can't be recorded, like if you look at the example, there are a couple of fields where some items didn't have any cost for the month, or didn't generate any revenue. since they cost one's don't have a revenue counterpart, it would be hard when recording a macro to have seperated properly.

it starts off like:






cost rev
022a25.00 022a230.00
025a 17.00 025a 150.00
025b 33.00 029a 170.00
027a 13.00


and i would want something like:









cost rev
022a 25.00 022a 230.00
_
025a 50.00 025a 150.00
_
027a 13.00 027a 000.00
_
029a 00.00 029a 170.00


where the cost of the like entries would be combined, since the revenue is only gauged on the A segments.

Last edited by homer15; 05-08-2002 at 04:35 PM.
homer15 is offline   Reply With Quote
Old 05-08-2002, 11:54 PM   #7
Member (10 bit)
 
PMich's Avatar
 
Join Date: Jan 2001
Location: Greenville, MS
Posts: 625
homer15
Give me a couple of days and I'm sure I can come up with something. Off the top of my head, their may be some filtering we can do to sort it. Probably won't have time to play with it until Friday night but bear with me and I'll get to it. If you could send me a pseudo file or files and a few more specifics via email at pmichene@uiuc.edu that would be a big help. Do you have any programs other than excel at your disposal?
PMich is offline   Reply With Quote
Old 05-09-2002, 12:00 AM   #8
Resident Slacker
 
homer15's Avatar
 
Join Date: Dec 2001
Location: Suisun City, California (i know, where the hell is that?!?!?)
Posts: 2,620
thanks pmich, that would be really cool. anything to help me get started. i could mail you the files i'm using tomorrow. i have the whole office suite available, but what other programs would you suggest i try?
homer15 is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:55 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2