SUMIF function summing the last 6 rows

Part16

New Member
Joined
Sep 7, 2014
Messages
19
Good mornign to all,

I am trying to sum the last 6 rows in a continuously growing table when a specific name in a different column (letters column) is met.

In the below example I would like to sum lets say the last 2 entries when the letter in the first column is C.

I can get the last 6 rows results with the below function but I can not apply SUMIF or anything like it to filter the data when a criteria is met.

Any help is very much appreciated.

=SUM(OFFSET(A1;MATCH(1E+30;A:A)-1;0;-6;1))

[TABLE="width: 30"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]A
[/TD]
[TD="align: right"]5
[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]4
[/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD="align: right"]5[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hi, welcome to the forum!

Here is one possibility:
Rich (BB code):
=SUMIF(INDEX(A:A,MATCH(9.99999999999999E+307,B:B)-5):INDEX(C:C,MATCH(9.99999999999999E+307,B:B)),E1,INDEX(B:B,MATCH(9.99999999999999E+307,B:B)-5):INDEX(B:B,MATCH(9.99999999999999E+307,B:B)))

Excel Workbook
ABCDEF
1A5C8
2B4
3C3
4A3
5B4
6C5
7A5
8B4
9C3
10A3
11B4
12C5
Sheet1
 
Upvote 0
Does this work for you?

=SUMIF(OFFSET(A1;MATCH(1E+30;B:B)-1;;-6;1);"C";OFFSET(A1;MATCH(1E+30;B:B)-1;1;-6;1))
 
Upvote 0
Also:

=SUMIF(OFFSET(INDEX(A:A,MATCH(9.99999999999999E+307,B:B)),0,0,-MIN(6,COUNT(B:B))),"C",B:B)

which reduces the volatility to just one OFFSET. Although admissible, I get a bit uneasy with the B:B bit set up against a definite/calculated range. The COUNT(B:B) bit can be replaced with COUNTA(A:A) which would seem more coherent.
 
Upvote 0
Hi All,

First of all I would like to thank all of you for your precious time and help. It is really very important to me.

Unfortunately I can not make it work for some reason.

I am making a sports database and in the first sheet I want to fill the goals scored and conceded and in another sheet I would like to have the sum of these goals for the last six games so as to calculate the average and make some other calculations.

Do these solutions work for multiple sheets?
 
Upvote 0
Hi All,

First of all I would like to thank all of you for your precious time and help. It is really very important to me.

Unfortunately I can not make it work for some reason.

I am making a sports database and in the first sheet I want to fill the goals scored and conceded and in another sheet I would like to have the sum of these goals for the last six games so as to calculate the average and make some other calculations.

Do these solutions work for multiple sheets?

Try to list the names of the sheets involved ("first sheet" and "another sheet" do not help to adjust a proposed formula).
 
Upvote 0
Hi Aladin,

The first sheet is called "Results" and the second is called "Teams".

The column with the goals is CL4:CL50000 (CL1 to CL3 have some subtotal functions calculating the average odds) of the sheet "results" and the column of the team names is B:B from the sheet "teams".

Although I made it work to a simplified form in one sheet in another file I can't do it to this one.

Below you may see an example of the data in "Results". The last 4 columns have the goals.

I want to apply the formula to the cell next of each team in the sheet "teams" .

(The names are in Greek sorry...)

[TABLE="width: 1052"]
<tbody>[TR]
[TD]Date
[/TD]
[TD]League[/TD]
[TD]1[/TD]
[TD]Home[/TD]
[TD]X[/TD]
[TD]Away[/TD]
[TD]2[/TD]
[TD]HT GH[/TD]
[TD]HT GA[/TD]
[TD]FT GH[/TD]
[TD]FT GA[/TD]
[/TR]
[TR]
[TD]17/8/2013[/TD]
[TD]ΑΓΠ[/TD]
[TD]1,30[/TD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ΟΝΣΙ[/TD]
[TD]2,50[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]1/9/2013[/TD]
[TD]ΑΓΠ[/TD]
[TD]2,40[/TD]
[TD]ΛΙΒΕΡΠΟΥΛ[/TD]
[TD]3,25[/TD]
[TD]ΜΑΝΤΣΕΣΤΕΡ Γ.[/TD]
[TD]2,65[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]1/9/2013[/TD]
[TD]ΑΓΠ[/TD]
[TD]1,90[/TD]
[TD]ΑΡΣΕΝΑΛ[/TD]
[TD]3,40[/TD]
[TD]ΤΟΤΕΝΑΜ[/TD]
[TD]3,20[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]14/9/2013[/TD]
[TD]ΑΓΠ[/TD]
[TD]1,15[/TD]
[TD]ΜΑΝΤΣΕΣΤΕΡ Γ.[/TD]
[TD]6,35[/TD]
[TD]ΚΡΙΣΤΑΛ ΠΑΛΑΣ[/TD]
[TD]9,50[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]2[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Hi All and thank you again for your valuable time,

Has anyone managed to understand if the problem is me, not applying the formulas correctly to the file or it is not possible to apply them on multiple sheets?

Below you may find the sheets names and ranges that I would like to use.

"The column with the goals is CL4:CL50000 (CL1 to CL3 have some subtotal functions calculating the average odds) of the sheet "results" and the column of the team names is B:B from the sheet "teams"."

Any form of help is appreciated.

Thank you in advance.
 
Upvote 0
Hi All and thank you again for your valuable time,

Has anyone managed to understand if the problem is me, not applying the formulas correctly to the file or it is not possible to apply them on multiple sheets?

Below you may find the sheets names and ranges that I would like to use.

"The column with the goals is CL4:CL50000 (CL1 to CL3 have some subtotal functions calculating the average odds) of the sheet "results" and the column of the team names is B:B from the sheet "teams"."

Any form of help is appreciated.

Thank you in advance.

Hard to follow what you mean by multiple sheets...

Try to map the formula set up for your initial sample to your real data. Say at least to which ranges it must be applied: What is the range for which the condition like "C" must be run and which range must be summed?
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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