Closed Thread
Results 1 to 11 of 11

Link data in multiple Excel files

  1. #1
    Registered User
    Join Date
    03-10-2007
    Posts
    12

    Link data in multiple Excel files

    First of all I'm not a programmer nor do I have much experience with databases. I've been searching the web and here to mostly find out if I can do what I need to. I haven't found answers as I may not be using the correct vocabulary to do my searches.

    Here is what I'd like to do.

    I have a template for an Excel file that I use each day to record various pieces of data. One of those fields contains a number which represents a certain number of hours. I create a new file each day and it goes into a folder with all the other day's individual Excel files. What I'd like to do is have a field in my template that shows the cumulative hours as they add up from all of the individual Excel daily files.

    What I'd like to happen is that I input my hours for today for example and save that file. Tomorrow I open my template, fill it out, put my hours in and below that field, I see the cumulative hours, which in this example, would only have been yesterday's hours. But, as time goes on, that cumulative field grows.

    Is this possible? If so, could you steer me in the right direction keeping in mind I'd need some very specific directions as I don't have any experience using external data and may not know what you are talking about if the help is too brief and takes for granted that I know what you are talking about.

    Regards...

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Would like to link data in multiple Excel files

    The best advice I have for you is that using a different file for each day is not a good way to solve your problem. The textbook method would be to use a single file with a column for the date. If you do that, everything else becomes much easier. It becomes almost trivial to produce cumulative totals, and almost any other analysis of the data is straightforward.

    To do what you describe with multiple files might be possible if you make a datestamp part of the name of each file, but it is really is doing it the hard way. It can probably be done with formulas, though VBA might give a more elegant solution.

    I might be able to offer more detailed information if you are able to post a file (the blank template would be fine) along with a description of your file naming convention. Also describe any constraints, such as "my company requires these templates so I can't put all days in a single file."
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    03-10-2007
    Posts
    12

    Re: Would like to link data in multiple Excel files

    Hey, thanks for the answer. Yea, I know it's easier in a single file instead of day-to-day separate files. I do know that much about databases but beyond that I'm still learning.

    Here's my gig. I'm a sailor. Each time I sail I create a Log of the day and then I attach an image of where we sailed. Those get printed out and put in a binder and then I have a running Log for the boat. I have a nice form too. What I want to do isn't that important and having a Log per file/day 'is' more important. But, I thought that since I'm already noting the engine hours, why not have the database tally that as I go along? I can do it by hand later but if there was a way to have the individual files in a folder automatically update the engine hours field I'd have my cake and eat it too.

    If it's just too difficult to do, I'll just forget about it. You never know when you post what answers you'll get. Someone could have just as easily have said, "sure, that's easy, just do this and that and reference the other and you are good to go." Unfortunately, per your answer, it's not going to be that easy.

    I like a good challenge and am fascinated by databases recently so trying to figure it out would be fun no matter how difficult. If you have a good direction to send me in to explore doing it or have a few good hints I'd appreciate it. I've attached one of my Logs. Just be aware, it was never set up originally to be used in a database so it probably needs a bit or reconfiguration.
    Attached Files Attached Files

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Would like to link data in multiple Excel files

    Not that difficult, I'll try to whip something up. Do you want to accumulate totals for all files, or by month, or some other method?

  5. #5
    Registered User
    Join Date
    03-10-2007
    Posts
    12

    Re: Would like to link data in multiple Excel files

    I like your tag line by the way... 'one fret at at time...'

    What I'd do is have a folder for each year. It might wind up with 30-50 logs in it depending how much I sail that year. I'd want each yearly folder to tally the engine hours for all the files in that folder so that if I open the last log file in that yearly folder, it will show me the accumulated number of hours for that year.

    Now that might cause a problem. What if I open one of the middle log files after having created a bunch of logs after it. What would it now show? I might be creating a mess. It might have to be that the only time I'd get an accurate hour tally is to open the most recent log file only. You'd have to let me know about that.

    Then, I'd just do the same thing each year. So if each yearly folder needs to have a couple of files in it to create the linking then I'd just copy those pertinent files manually into the new year's folder where they could sit in anticipation of incoming log files as the year progresses.

    I really appreciate your assistance.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Would like to link data in multiple Excel files

    I was going to use INDIRECT to use formulas but then realized that INDIRECT with an external file requires the file to be open.

    I will write a bit of VBA to do this, will be back tomorrow!

  7. #7
    Registered User
    Join Date
    03-10-2007
    Posts
    12

    Re: Would like to link data in multiple Excel files

    No hurry. You are doing be a big favor. Will I be able to reverse engineer what you are doing so I can learn or will I need a compiler or something?

    Seriously, take your time. I'm in no hurry. Very nice of you to help me out but don't be afraid to put me to work. I want to learn more about databases.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Would like to link data in multiple Excel files

    Here is a solution using VBA. This assumes that:
    1. All your files use the same format for the file name, that is, they all end in "Magenpie Sailing Log.xlsx".
    2. All files have the running time in Sheet1!C9.
    It looks at all files in the same directory where this summary file is stored, and loads any files conforming to #1 above.

    You have to make one change in your template: In C9, you are recording the hours as "3 hr", which is text. To do arithmetic, you must change the format to time (i.e., "3:00"). The alternative would be to store it as decimal hours (i.e., 3.00). Either one would work but if the latter then you also have to change the format in the summary file to match.

    Edit:
    No hurry. You are doing be a big favor. Will I be able to reverse engineer what you are doing so I can learn or will I need a compiler or something?
    VBA is built into Excel, you don't need anything else. You will have to know how to get to the VBA development environment if you want to see/modify code.

    If you are interested in details of how the VBA works let me know and I can walk through it.

    (BTW you referred to databases but I would not consider this a database. It is possible to use Excel to effectively create a database but I don't think pulling a data field out of a collection of files qualifies.)
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    03-10-2007
    Posts
    12

    Re: Would like to link data in multiple Excel files

    That works great...really nice of you. Let me dive in and dissect it. If I have trouble I'll post back. I understand the comment about 'databases' and just pulling from a 'field.' I don't think a Chihuahua qualifies as a dog...but it's not my call...LOL...

    I'll play with it a bit (will back it up first) and see what I can learn.

    Thanks again... it will do what I need.

    Best regards-

  10. #10
    Registered User
    Join Date
    05-11-2012
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Link data in multiple Excel files

    Hi i have a question.

    I doing a report regarding doing some administration work using alot of excel.

    Apparently, my lecturer has asked me to link information from a folder full of excel files into one spreadsheet that will automatically update when you update the invoices.

    i want to take data like for example, the date, and put it into another spreadsheet.

    i tried to use the methods that your guys provided on the above but that only helps if you have only a few folders. however if you have 100 files to link up. its a nightmare!

    therefore, is there a way that you can link 100 files all at a time?

  11. #11
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Link data in multiple Excel files

    Lesterchoy18,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1