Sum Multiple Rows Based on Upper and Lower Limit

paulkc

Board Regular
Joined
May 18, 2007
Messages
204
Office Version
  1. 365
The following data is a list of various pieces of data related to different grades in a K-12 school. You will see in the first 13 rows that there is a row for each grade.
In rows 21-25, I'm trying to build a series of sums based on the data from the top of the sheet. In these rows, you will see a lower and upper limit in the first 2 columns. I'd like to sum the data in the corresponding cells above based on those limits. Let me explain it from the perspective of F22. You will see that currently the formula is =sum(f4:f5) based on the grades 1 and 2. What I want to do is be able to change the upper or lower limit to dynamically see the sum of of more or less grades from the above data. I've tried several different functions but can't seem to find the right combination to accomplish this. Thanks in advance.

Current Fees.xlsx
ABFGHIJKLMNO
30208100000
412158010010
5221360808
6311790606
7400660909
85219120606
965139012012
10710230909
11810340303
12900220404
131020240202
141100110404
151200110101
16
171855275074074
18
19
20
21002081010000010
2212428142001801820
23341113152001501520
24578214241502702715
258123091290140149
FCA Class Counts
Cell Formulas
RangeFormula
F17:H17,K17:M17F17=SUM(F3:F15)
I17,N21:N25,I21:I25,N17I17=SUM(F17:H17)
F21:H21,K21:M21F21=F3
F22:H22,K22:M22F22=SUM(F4:F5)
F23:H23,K23:M23F23=SUM(F6:F7)
F24:H24,K24:M24F24=SUM(F8:F10)
F25:H25,K25:M25F25=SUM(F11:F15)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
H21:H25,M21:M25,U24:U26,H27,M27Expression=J21-H21<0textNO
H21:H25,M21:M25,U24:U26,H27,M27Expression=J21-H21<1textNO
H21:H25,M21:M25,U24:U26,H27,M27Expression=J21-H21<2textNO
I21:I25,N21:N25,V24:V26,I27,N27Expression=J21-I21<0textNO
I21:I25,N21:N25,V24:V26,I27,N27Expression=J21-I21<1textNO
I21:I25,N21:N25,V24:V26,I27,N27Expression=J21-I21<2textNO
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
what version of excel are you using? Please update your profile so the excel version appears on your button/icon.
 
Upvote 0
I updated in the profile but not sure how to make it show up. I'm using office 365 but also using some of this in google sheets.
 
Upvote 0
Oops, I wasn't looking in the right place. Either way, question answered.
 
Upvote 0
Okay,
well try this:
Mr excel questions 52.xlsm
ABCDEFGHIJKLMN
1
2
30208100000
412158010010
5221360808
6311790606
7400660909
85219120606
965139012012
10710230909
11810340303
12900220404
131020240202
141100110404
151200110101
16
171855275074074
18
19
20Lower LimitUpper Limit
21002081000000
2212428140018018
23341113150015015
24578214240027027
25812309120014014
paulkc
Cell Formulas
RangeFormula
F17:H17,K17:M17F17=SUM(F3:F15)
I17,N17I17=SUM(F17:H17)
F21:N25F21=SUM(INDEX(F$3:F$15,$B21+1):INDEX(F$3:F$15,$A21+1))
 
Upvote 0
Solution
For
I updated in the profile but not sure how to make it show up. I'm using office 365 but also using some of this in google sheets.
Well, the version did not make much difference. I thought I would use a FILTER function which is only in 365. But, as I started I felt that using INDEX function to build cell references would work just as well. I think it does.
 
Last edited:
Upvote 0
Another option in F21 dragged down & across
Excel Formula:
=SUMIFS(F$3:F$15,$B$3:$B$15,">="&$A21,$B$3:$B$15,"<="&$B21)
 
Upvote 0
Okay,
well try this:
Mr excel questions 52.xlsm
ABCDEFGHIJKLMN
1
2
30208100000
412158010010
5221360808
6311790606
7400660909
85219120606
965139012012
10710230909
11810340303
12900220404
131020240202
141100110404
151200110101
16
171855275074074
18
19
20Lower LimitUpper Limit
21002081000000
2212428140018018
23341113150015015
24578214240027027
25812309120014014
paulkc
Cell Formulas
RangeFormula
F17:H17,K17:M17F17=SUM(F3:F15)
I17,N17I17=SUM(F17:H17)
F21:N25F21=SUM(INDEX(F$3:F$15,$B21+1):INDEX(F$3:F$15,$A21+1))
This was perfect! Thanks for the help.
 
Upvote 0
Great, i'm pleased you found a solution here.

Best Wishes!
 
Upvote 0

Forum statistics

Threads
1,215,124
Messages
6,123,190
Members
449,090
Latest member
bes000

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