Sum data across sheets - if certain value is selected

svjensen

Board Regular
Joined
Jun 10, 2009
Messages
118
I have a number of identical sheets containing similar data (data in cells E10 through F15. These are all placed within two "limiters" - 'start ->' and '<- end'.

On my summation sheet I sum up the data be using '=SUM(start ->:<- end!E10)' in cell E10 (and so on until F15).

Now I would like to sum up only the data from sheets which have a value in cell A1, which is identical to the one in A1 on my summation sheet.

If you need more explanatio please let me know.

/Soren
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi
Insert / rename a sheet as Total. Paste the following codes in the macro window (alt f11) and run the macro.
Code:
Sub Soren()
Dim a As Long, b As Long, c As Long
Worksheets("Total").Range("E10:F15").ClearContents
    For a = 1 To Sheets.Count
        If Worksheets(a).Name <> "Total" Then
            For b = 5 To 6
                For c = 10 To 15
                    If Worksheets(a).Cells(1, 1) <> "" And Worksheets(a).Cells(1, 1) = Worksheets("Total").Cells(1, 1) Then
                    Worksheets("Total").Cells(c, b) = Worksheets("Total").Cells(c, b) + Worksheets(a).Cells(c, b)
                    End If
                Next c
            Next b
        End If
    Next a
MsgBox "Summation is complete"
End Sub
Ravi
 
Upvote 0
try this

E10

Code:
=SUMPRODUCT(
          SUMIF(INDIRECT(G1:G10 & "!A1"),A1,
                  INDIRECT(G1:G10 & "!" & ADDRESS(ROW(),COLUMN()))))

where G1:G10 houses the list of sheet names, excluding the active sheet
 
Upvote 0
u can use this code to get all sheets name in range G
to use Sankar Formula easy
Code:
Sub SheetNames()
    For i = 1 To Sheets.Count
    Sheets("Sheet1").Range("g" & i).Value = Sheets(i).Name
    Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top