Formula for adding cells (with a row interval)

Jojo86

New Member
Joined
Jul 24, 2023
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hi,

Some months ago I had a similar question and it was solved here: Formula for adding cells (with a 5 row interval)
using this formula: =SUM(IF(MOD(ROW('21 SUP'!A15:A100),5)=0,'21 SUP'!A15:A100,0))

My question this time is this:

I have a lot of columns and in each column I have to add several cells (with a 1 row interval and a 4 row internal):

Example:
Column A1 ='21 SUP'!A1+'21 SUP'!A5+'21 SUP'!A6+'21 SUP'!A10+'21 SUP'!A11+'21 SUP'!A15+'21 SUP'!A16 etc
Column B1 ='21 SUP'!B1+'21 SUP'!B5+'21 SUP'!B6+'21 SUP'!B10+'21 SUP'!B11+'21 SUP'!B15+'21 SUP'!B16 etc

-> Can you please give me a formula I can use that can be used in different columns?

Thanks everyone
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
had to change 3 of the , to ;
You might need to change all 4 of the , to ; since I assume that your decimal separator is ","
However, I still think the formula is a bit 'risky' in that if ever rows are inserted/deleted at the top of either of the other two sheets, the formulas will, without warning or error, return incorrect results.

Here is another approach that you could consider.

Jojo86_1.xlsm
ABC
1Jun-22Jul-22
221 SUP37229
331 CMSW7069
Help
Cell Formulas
RangeFormula
B2:C2B2=LET(r,'21 SUP'!X11:X77,s,MOD(SEQUENCE(ROWS(r)),5),SUM(FILTER(r,(s=1)+(s=2))))
B3:C3B3=LET(r,'31 CMSW'!X11:X77,s,MOD(SEQUENCE(ROWS(r)),5),SUM(FILTER(r,(s=1)+(s=2))))


BTW, are there any row labels in '21 SUP' and '31 CMSW' (maybe in column A?) that could help identify which rows to add, rather than relying solely on the add two, skip 3 idea?
 
Upvote 1
The first one is Subcontractors and the other is Travel.
If that means rows 11, 16, 21, 26 etc is "Subcontractors" and rows 12, 17, 22, 27 etc is "Travel" like below, then assuming those are in column A of the two other sheets, try this which to me is a much better/safer way to approach the task.

Jojo86_1.xlsm
AXY
10Jun-22Jul-22
11Subcontractors122
12Travel254
13
14
15
16Subcontractors2377
17Travel1176
21 SUP


Jojo86_1.xlsm
AXY
10Jun-22Jul-22
11Subcontractors1010
12Travel1222
13
14
15
16Subcontractors4433
17Travel44
31 CMSW


Jojo86_1.xlsm
ABC
1Jun-22Jul-22
221 SUP37229
331 CMSW7069
Help
Cell Formulas
RangeFormula
B2:C2B2=SUM(SUMIF('21 SUP'!$A$11:$A$77,{"Subcontractors","Travel"},'21 SUP'!X11:X77))
B3:C3B3=SUM(SUMIF('31 CMSW'!$A$11:$A$77,{"Subcontractors","Travel"},'31 CMSW'!X11:X77))
 
Upvote 1
Solution
Try this?
Excel Formula:
=SUM(IF(MOD(ROW('21 SUP'!A1:A100),5)={0,1},'21 SUP'!A1:A100,0))
 
Upvote 0
I would suggest adding some insurance so that if any rows were subsequently added at the top of '21 SUP' the formula would still add the same values.
Excel Formula:
=SUM(IF(MOD(SEQUENCE(100),5)={0,1},'21 SUP'!A2:A101,0))
 
Upvote 0
Thanks everyone. I changed the , to ; however I'm getting 0 as a result. Am i doing something wrong?
 
Upvote 0
Could you give us some small sample data and expected results with XL2BB?
 
Upvote 0
Could you give us some small sample data and expected results with XL2BB?
I can't even install XL2BB :ROFLMAO: "The file type is not supported in Protected View"

I'll get back to this when i have more time. Thanks all.
 
Upvote 0
Ok I managed :)

First one is what I want fixed.
Second and third are where the data is from.

Thanks

Book1
ABC
1June 2022July 2022
221 SUP37229
331 CMSW7069
Help
Cell Formulas
RangeFormula
B2:C2B2='21 SUP'!X11+'21 SUP'!X12+'21 SUP'!X16+'21 SUP'!X17+'21 SUP'!X21+'21 SUP'!X22+'21 SUP'!X26+'21 SUP'!X27+'21 SUP'!X31+'21 SUP'!X32+'21 SUP'!X36+'21 SUP'!X37+'21 SUP'!X41+'21 SUP'!X42+'21 SUP'!X46+'21 SUP'!X47+'21 SUP'!X51+'21 SUP'!X52+'21 SUP'!X56+'21 SUP'!X57+'21 SUP'!X61+'21 SUP'!X62+'21 SUP'!X66+'21 SUP'!X67+'21 SUP'!X71+'21 SUP'!X72+'21 SUP'!X76+'21 SUP'!X77
B3:C3B3='31 CMSW'!X11+'31 CMSW'!X12+'31 CMSW'!X16+'31 CMSW'!X17+'31 CMSW'!X21+'31 CMSW'!X22+'31 CMSW'!X26+'31 CMSW'!X27+'31 CMSW'!X31+'31 CMSW'!X32+'31 CMSW'!X36+'31 CMSW'!X37+'31 CMSW'!X41+'31 CMSW'!X42+'31 CMSW'!X46+'31 CMSW'!X47+'31 CMSW'!X51+'31 CMSW'!X52+'31 CMSW'!X56+'31 CMSW'!X57+'31 CMSW'!X61+'31 CMSW'!X62+'31 CMSW'!X66+'31 CMSW'!X67+'31 CMSW'!X71+'31 CMSW'!X72+'31 CMSW'!X76+'31 CMSW'!X77


Book1
XY
10June 2022July 2022
11122
12254
13
14
15
162377
171176
21 SUP


Book1
XY
10June 2022July 2022
111010
121222
13
14
15
164433
1744
31 CMSW
 
Upvote 0

Forum statistics

Threads
1,215,585
Messages
6,125,679
Members
449,248
Latest member
wayneho98

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