?
Solved

how to call Sum function from cell in workbook and refresh on any change

Posted on 2014-11-07
7
Medium Priority
?
198 Views
Last Modified: 2014-11-07
Hello,

I have multiple sheets in a workbook.  On a few of the sheets, I want to sum the value in F3.  I want the sum to appear on a specific sheet titled and location and be an automatic update if the values in any of the sheets change.  

I have this function in the Module of the workbook:
Function SumSeries(SumRange As Range) As Double
Dim ws As Worksheet
Dim TopTotals As Double
     
    TopTotals = 0
    For Each ws In ThisWorkbook.Worksheets
        If ws.Name <> "Metrics" And ws.Name <> "TFSData" And ws.Name <> "TFSBugs" Then
            TopTotals = TopTotals + WorksheetFunction.Sum(ws.Range(sum_Range.Address))
        End If
    Next ws
    SumSeries = TopTotals
   
 
End Function

I have tried placing variations in the cell like =SumSeries($F3) but I get #VALUE.   How do I structure what should be in the cell formula to call the function, and have it automatically update when any value within the Sum is updated?
0
Comment
Question by:Kathtg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 34

Accepted Solution

by:
Norie earned 2000 total points
ID: 40428606
Try this.


            TopTotals = TopTotals + WorksheetFunction.Sum(ws.Range(SumRange.Address))
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 40428680
Is there any reason why you don't just use:

=SUM(Sheet1!F3,Sheet2!F3,Sheet3!F3)   amending sheet names appropriately.

if some of the sheets are in sequence and there is no risk that sheets could be inserted that you do not wish to include:

=SUM('Sheet1:Sheet3'!F3,Sheet5!F3)

Thanks
Rob H
0
 

Author Comment

by:Kathtg
ID: 40428686
Each tester has a separate workbook that has an automatic copy button.  It deletes the sheet and replaces it with the newer version.  When this is done, the reference is lost.  I was looking into not deleting the sheet with replacement but 1.  I couldn't figure it out.   2.  we will have any number of testers and workbooks for each project so I thought making these sums dynamic will be the best route
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Kathtg
ID: 40428690
oh, sorry missed the top answer 0 imnorie.  Testing it now, thanks
0
 

Author Comment

by:Kathtg
ID: 40428694
well, ho molie, it was typo!!  doh, too many formulas in these small cells.  Thank you!
0
 

Author Closing Comment

by:Kathtg
ID: 40428697
Thank you
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 40428702
If the sheets are sequential, set a couple of blank sheets called Start and Finish and make sure that all sheets required for the Sum are in between these two.

The sum would then be:

=SUM(Start:Finish!F3)

There is then no reference to specific sheets that will get lost .

Thanks
Rob H
0

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question