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
 
1. Is the Sheet Name "Sheet1"?

2. Goto the Sub in VBE and add a break clicking on the left pane at the beginning of code.

Idea is when the event will be triggered you will be able to step through it .
 
Upvote 0

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Are your sheets literally named "1", "2", "3", or are they "Sheet1", "Sheet2", "Sheet3", or something else?

Need to identify exactly which sheets 1:100 refers to.
 
Upvote 0
yes sheet1

can u paste the code for range 1:1000

next time ill change it myself.just want to know where to change it in the code.thanks
 
Upvote 0
Unfortunately there will be no formula in #32 case.
The Sheets.Count in for loop will take care of all sheets. Be it 10 or 1000. It will go though all.
 
Last edited:
Upvote 0
Unfortunately there will be no formula in #32 case.
The Sheets.Count in for loop will take care of all sheets. Be it 10 or 1000. It will go though all.

thanks for your help tho.appreciate you still trying to help in this.hope jason can help.
 
Upvote 0
Try

Code:
Option Explicit
Public Function Sum_All(rng As Range, start As Long, finish As Long, Optional ignore As Long = 50) As Double
Application.Volatile
Dim Sum_Temp As Double, ws As Long
On Error Resume Next
For ws = start To finish
    If Sheets("Sheet" & ws).Range(rng.Address).Value >= ignore Then
        Sum_Temp = Sum_Temp + Sheets("Sheet" & ws).Range(rng.Address).Value
    End If
Next
On Error GoTo 0
Sum_All = Sum_Temp
End Function

The formula now has 3 mandatory parameters and one optional.

To sum A1 in each sheet from "Sheet1" to "Sheet100" enter

=Sum_All(A1,1,100)

As before this would sum all values > = 50, to sum the same range for values > = 100 use

=Sum_All(A1,1,100,100)

Hopefully that will get you sorted.
 
Upvote 0
it not work with me. this is example of my sheets. 11,1,3,4,8,5

i put in sheet11= A1=60 and sheet3= A1=60

so,i did as below from sheet11 to sheet5 the result turn 0.

=Sum_All(A1,11,5)

is there anything wrong i did?
 
Upvote 0
Not you, code is written assuming that sheets are 1,2,3,4,5,...

I misread one of your earlier replies as well, I'll do a quick edit and post some new code now I know exactly what is needed.
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

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