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

A
5
B4
C3
A3
B4
C5
A5
B4
C
3
A3
B4
C
5

<colgroup><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
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...)

Date
League1HomeXAway2HT GHHT GAFT GHFT GA
17/8/2013ΑΓΠ1,30ΛΙΒΕΡΠΟΥΛ4,25ΣΤΟΟΥΚ7,751010
17/8/2013ΑΓΠ1,30ΑΡΣΕΝΑΛ4,50ΑΣΤΟΝ ΒΙΛΑ7,001113
17/8/2013ΑΓΠ2,10ΓΟΥΕΣΤ ΜΠΡΟΜ3,20ΣΑΟΥΘΑΜΠΤΟΝ2,900001
17/8/2013ΑΓΠ1,85ΓΟΥΕΣΤ ΧΑΜ3,30ΚΑΡΝΤΙΦ3,451020
17/8/2013ΑΓΠ2,80ΝΟΡΓΟΥΙΤΣ3,20ΕΒΕΡΤΟΝ2,150022
17/8/2013ΑΓΠ2,10ΣΑΝΤΕΡΛΑΝΤ3,20ΦΟΥΛΑΜ2,900001
17/8/2013ΑΓΠ3,50ΣΟΥΟΝΣΙ3,25ΜΑΝΤΣΕΣΤΕΡ Γ.1,850214
18/8/2013ΑΓΠ4,15ΚΡΙΣΤΑΛ ΠΑΛΑΣ3,50ΤΟΤΕΝΑΜ1,650001
18/8/2013ΑΓΠ1,12ΤΣΕΛΣΙ6,25ΧΑΛ12,502020
19/8/2013ΑΓΠ1,20ΜΑΝΤΣΕΣΤΕΡ ΣΙΤΙ5,25ΝΙΟΥΚΑΣΤΛ9,002040
21/8/2013ΑΓΠ1,22ΤΣΕΛΣΙ5,15ΑΣΤΟΝ ΒΙΛΑ8,501121
24/8/2013
ΑΓΠ3,60ΦΟΥΛΑΜ3,30ΑΡΣΕΝΑΛ1,800213
24/8/2013
ΑΓΠ1,50ΕΒΕΡΤΟΝ3,65ΓΟΥΕΣΤ ΜΠΡΟΜ5,250000
24/8/2013
ΑΓΠ2,10ΝΙΟΥΚΑΣΤΛ3,30ΓΟΥΕΣΤ ΧΑΜ2,850000
24/8/2013
ΑΓΠ1,65ΣΑΟΥΘΑΜΠΤΟΝ3,45ΣΑΝΤΕΡΛΑΝΤ4,250111
24/8/2013
ΑΓΠ1,75ΣΤΟΟΥΚ3,30ΚΡΙΣΤΑΛ ΠΑΛΑΣ3,900121
24/8/2013
ΑΓΠ2,25ΧΑΛ3,20ΝΟΡΓΟΥΙΤΣ2,651010
24/8/2013ΑΓΠ3,60ΑΣΤΟΝ ΒΙΛΑ3,35ΛΙΒΕΡΠΟΥΛ1,800101
25/8/2013ΑΓΠ6,35ΚΑΡΝΤΙΦ4,25ΜΑΝΤΣΕΣΤΕΡ ΣΙΤΙ1,350032
25/8/2013ΑΓΠ1,50ΤΟΤΕΝΑΜ3,50ΣΟΥΟΝΣΙ5,500010
26/8/2013ΑΓΠ2,30ΜΑΝΤΣΕΣΤΕΡ Γ.3,15ΤΣΕΛΣΙ2,800000
31/8/2013ΑΓΠ1,12ΜΑΝΤΣΕΣΤΕΡ ΣΙΤΙ6,50ΧΑΛ11,500020
31/8/2013ΑΓΠ1,85ΓΟΥΕΣΤ ΧΑΜ3,30ΣΤΟΟΥΚ3,450001
31/8/2013ΑΓΠ2,70ΚΑΡΝΤΙΦ3,25ΕΒΕΡΤΟΝ2,200000
31/8/2013ΑΓΠ1,95ΝΙΟΥΚΑΣΤΛ3,35ΦΟΥΛΑΜ3,100010
31/8/2013ΑΓΠ2,55ΝΟΡΓΟΥΙΤΣ3,20ΣΑΟΥΘΑΜΠΤΟΝ2,350010
31/8/2013ΑΓΠ2,30ΚΡΙΣΤΑΛ ΠΑΛΑΣ3,20ΣΑΝΤΕΡΛΑΝΤ2,601031
1/9/2013ΑΓΠ2,35ΓΟΥΕΣΤ ΜΠΡΟΜ3,25ΣΟΥΟΝΣΙ2,500102
1/9/2013ΑΓΠ2,40ΛΙΒΕΡΠΟΥΛ3,25ΜΑΝΤΣΕΣΤΕΡ Γ.2,651010
1/9/2013ΑΓΠ1,90ΑΡΣΕΝΑΛ3,40ΤΟΤΕΝΑΜ3,201010
14/9/2013ΑΓΠ1,15ΜΑΝΤΣΕΣΤΕΡ Γ.6,35ΚΡΙΣΤΑΛ ΠΑΛΑΣ9,501020

<tbody>
</tbody>
 
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,215,323
Messages
6,124,244
Members
449,149
Latest member
mwdbActuary

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