sum cell all sheets with condition

spilner

Board Regular
Joined
Jun 7, 2011
Messages
146
okay,i want to sum all sheets with a condition.

example :
its all in the same cell example A1

sheet 1 = 50 , sheet 2 = 100 , sheet 3 = 1000 , sheet 4 = 30

if its more than 50 sum it.if its below than 50 then 0.

my formula is like this but it aint work.im not very good in excel.

=SUMIF('1:4'!A11,min(50,a11),0)

i dont know how to write this,hope someone can help me.thanks a lot guys
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Ok, think this is right,

Code:
Option Explicit
Public Function Sum_All(rng As Range, start As String, finish As String, Optional ignore As Long = 50) As Double
Application.Volatile
Dim Sum_Temp As Double, ws As Long, sIndex As Long, eIndex As Long
sIndex = Sheets(start).Index
eIndex = Sheets(finish).Index
For ws = sIndex To eIndex
    If Sheets(ws).Range(rng.Address) >= ignore Then
        Sum_Temp = Sum_Temp + Sheets(ws).Range(rng.Address)
    End If
Next
Sum_All = Sum_Temp
End Function

=Sum_All(A1,11,5) should give the correct result now.
 
Upvote 0
now it work perfect.ill test running for few days and hope theres no problem.

thanks a lot jason.
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

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