Solved

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

Posted on 2014-11-07
7
171 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
  • 4
  • 2
7 Comments
 
LVL 33

Accepted Solution

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


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

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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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 31

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
This collection of functions covers all the normal rounding methods of just about any numeric value.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now