PC Review


Reply
Thread Tools Rate Thread

Calculate sum in multiple files

 
 
Tomos
Guest
Posts: n/a
 
      24th Aug 2005

I have over 300 individual excel files that contain job sheets for sites
that my company visits. The layout of each file is identical and there
is a particular column in each file containing 5 cells that requires
summing.

I need to create a new file with site names (the file names same as
site names) in column A, and the sum of each of the 5 cells in all
these files.

Is there a way to do this without opening every single file and summing
the cells back to the new sheet?

Hope I've been clear enough


--
Tomos
------------------------------------------------------------------------
Tomos's Profile: http://www.excelforum.com/member.php...o&userid=26581
View this thread: http://www.excelforum.com/showthread...hreadid=398527

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      24th Aug 2005
You can reference a closed workbook easily enough

=SUM('C:\MyTest\[test 1.xls]Sheet2'!$A$1:$A$5)

but you will need to adopt for each, you can't put the names ina list and
use that, INDIRECT doesn't work with closed workbooks.

--
HTH

Bob Phillips

"Tomos" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
>
> I have over 300 individual excel files that contain job sheets for sites
> that my company visits. The layout of each file is identical and there
> is a particular column in each file containing 5 cells that requires
> summing.
>
> I need to create a new file with site names (the file names same as
> site names) in column A, and the sum of each of the 5 cells in all
> these files.
>
> Is there a way to do this without opening every single file and summing
> the cells back to the new sheet?
>
> Hope I've been clear enough
>
>
> --
> Tomos
> ------------------------------------------------------------------------
> Tomos's Profile:

http://www.excelforum.com/member.php...o&userid=26581
> View this thread: http://www.excelforum.com/showthread...hreadid=398527
>



 
Reply With Quote
 
Tomos
Guest
Posts: n/a
 
      24th Aug 2005

That's what I've been doing. It's just so time consuming typing the
individual file names in.

Is there any way to list all the file names in a folder then use the
sum formula to refer to the cell with the file name in for the
=SUM(XXXSheet2'!$A$1:$A$5) XXX bit?


--
Tomos
------------------------------------------------------------------------
Tomos's Profile: http://www.excelforum.com/member.php...o&userid=26581
View this thread: http://www.excelforum.com/showthread...hreadid=398527

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      24th Aug 2005
No, that is the INDIRECT part I mentioned before, but it doesn't work with
closed workbooks.

There is a function available if you search Google called Pull, which reads
from closed workbooks in that manner, but that would probably take as much
effort as doing them all.

Just thought. Another way.

Put the list of file names in column A, File.xls, File 2.xls, etc.
Then put your formula in B1, but use XXXX for the filename, like so

=SUM('C:\[XXXX]Sheet1'!$A$1:$A$5)
Then run this bit of code

Sub Test()
Dim iLastRow As Long
Dim i As Long

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
Cells(i, "B").Formula = Replace(Cells(i, "B").Formula, "XXXX",
Cells(i, "A").Formula)
Next i

End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Tomos" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
>
> That's what I've been doing. It's just so time consuming typing the
> individual file names in.
>
> Is there any way to list all the file names in a folder then use the
> sum formula to refer to the cell with the file name in for the
> =SUM(XXXSheet2'!$A$1:$A$5) XXX bit?
>
>
> --
> Tomos
> ------------------------------------------------------------------------
> Tomos's Profile:

http://www.excelforum.com/member.php...o&userid=26581
> View this thread: http://www.excelforum.com/showthread...hreadid=398527
>



 
Reply With Quote
 
Harlan Grove
Guest
Posts: n/a
 
      24th Aug 2005
Tomos wrote...
>That's what I've been doing. It's just so time consuming typing the
>individual file names in.
>
>Is there any way to list all the file names in a folder then use the
>sum formula to refer to the cell with the file name in for the
>=SUM(XXXSheet2'!$A$1:$A$5) XXX bit?


If you're summing the same range of cells in the same named worksheet
in multiple files, then you may be better off using Data > Consolidate.
Select the cell where you want the sum to appear, run Data >
Consolidate, and enter a Reference like

<your path here>\[*.xls]SheetX!$Y$99

and Excel will place the sum of all XLS file's SheetX!Y99 values in the
active cell.

 
Reply With Quote
 
Tomos
Guest
Posts: n/a
 
      25th Aug 2005

Thats useful to know actually! But I will need different sums from all
separate sheets rather than just one.

Thanks for all your help guys and gals, looks like its going to have to
be a manual jobbie.


--
Tomos
------------------------------------------------------------------------
Tomos's Profile: http://www.excelforum.com/member.php...o&userid=26581
View this thread: http://www.excelforum.com/showthread...hreadid=398527

 
Reply With Quote
 
 
 
Reply

Thread Tools
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 Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IS THERE A WAY TO SEARCH FOR AND CALCULATE MULTIPLE EXCEL FILES? BRIAN MCDNALD Microsoft Excel Programming 1 31st Dec 2008 04:59 PM
how to calculate multiple roots risto Microsoft Excel Worksheet Functions 2 9th Dec 2008 09:34 PM
How does Excel calculate Multiple R when doing multiple regression whobell Microsoft Excel Worksheet Functions 1 8th Apr 2008 11:11 PM
How do I calculate times over multiple records? =?Utf-8?B?SmltIE1vYmVyZw==?= Microsoft Access Queries 7 13th Oct 2006 02:38 PM
Calculate multiple results from multiple input values? Jetta1515 Microsoft Excel Misc 5 1st Jun 2006 03:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:40 PM.