Adding a given amount of rows

Marvo

Board Regular
Joined
Nov 27, 2023
Messages
172
Office Version
  1. 2021
Platform
  1. Windows
If you had in column A a list of numbers, so A1=3, A3=1, A3=0, A4=1, A5=1, A6=3, A7=3, A8=0, A9=3, A10=1

and you put in cell C11 a given number, say for example 5,

what would be the formula required in Cell B10 to add the most recent 5 rows A6:A10 (Answer 10) or however many rows you ask for in C11?

Any help much appreciated
 

Attachments

  • Mr Excel.JPG
    Mr Excel.JPG
    13.5 KB · Views: 13

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi Marvo

Mappe9
ABCD
13
21
30
41
51
63
73
80
93
101
11510
Tabelle1
Cell Formulas
RangeFormula
D11D11=SUM(INDEX(A1:A10,SEQUENCE(C11,,COUNT(A1:A10)-C11+1)))
 
Upvote 0
That's brilliant, thank you. Is there a way for that to work if a cell was blank and needs to be ignored? I have one criteria that would rule out certain rows.
 
Upvote 0
So the criteria is All Matches or just League. I would like to look back at ALL matches, then just league matches. Maybe a filter?
 

Attachments

  • Mr Excel.JPG
    Mr Excel.JPG
    30.1 KB · Views: 16
Upvote 0
If I add the yellow rows that would be 12 for League and not 11, wouldn't it?
 
Upvote 0
Doh! Yes, you're right. Sorry I added them up in my head.

In the actual workbook (5,550 rows) I have a second column with just the league points showing and the cup games as blanks. That's why I was asking the follow up question. Obviously just one column would be better.
 
Upvote 0
Mappe9
ABCDEF
13League
21League
31League
41League
53Cup
60League
73League
83League
90League
103League
111League
12814All
1312League
Tabelle1 (2)
Cell Formulas
RangeFormula
E12E12=SUM(INDEX(A1:A11,SEQUENCE(D12,,COUNT(A1:A11)-D12+1)))
E13E13=LET( league,FILTER(A1:A11,B1:B11="League"), matches,D12, SUM(INDEX(league,SEQUENCE(matches,,COUNT(league)-matches+1))))
 
Upvote 1
Solution
That is absolutely fantastic, thank you so much. Its even allowed me to get rid of a now unneeded column. Much obliged.
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,174
Members
452,615
Latest member
bogeys2birdies

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