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
 
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

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hei,

I changed all 4 , to ; and got N/A error.

HOWEVER your new formula (below) Peter worked. Thanks :)
RangeFormula
Cell Formulas
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))))

I didn't think about the Row Labels (i'm not good in excel). The first one is Subcontractors and the other is Travel. If you would like to share that in a formula too that would be great :) Thanks.
 
Upvote 0
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
You're very welcome. Thanks for the confirmation. :)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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