filter bank transactions and then sum

I've got a spreadsheet of all my bank transactions and I want to filter them by type and them the results.

eg.
Tran Type Amount
1 A 1.5
2 B 2.0
3 A 3.5

I can use Data/More Filters/Standard Filer to get:
Tran Type Amount
1 A 1.5
3 A 3.5

but sum(C1:C3) gives 7.0 (the sum of the unfiltered spreadsheet.

I can copy but filtered rows but that is too easy. :slight_smile:
What is the hardest overkill way? :slight_smile:
Maybe a template or macro that I can reuse.
I just want to filter them so I can add up the interest I got.

Hi James,

you can use the function SUBTOTAL.
https://help.libreoffice.org/6.3/en-US/text/scalc/01/04060106.html?DbPAR=CALC#bm_id3165633

Kind regards
Regina

James wrote:

I've got a spreadsheet of all my bank transactions and I want to filter them by type and them the results.

eg.
Tran Type Amount
1     A   1.5
2     B   2.0
3     A   3.5

I can use Data/More Filters/Standard Filer to get:
Tran Type Amount
1     A   1.5
3     A   3.5

but sum(C1:C3) gives 7.0 (the sum of the unfiltered spreadsheet.

I can copy but filtered rows but that is too easy. :slight_smile:
What is the hardest overkill way? :slight_smile:
Maybe a template or macro that I can reuse.
I just want to filter them so I can add up the interest I got.

Assuming the above is in columns A, B. and C, and rows 1, 2, 3 and 4 ...
    In Cell D2 place ... =IF(B2="A",C2,0)
    In Cell E2 place ... =IF(B2="B",C2,0)
Drag those down to fill the relevant cells, and SUM those columns.
Hope that helps
Regards
Fred James

James,

[...]
but sum(C1:C3) gives 7.0 (the sum of the unfiltered spreadsheet.

I can copy but filtered rows but that is too easy. :slight_smile:
What is the hardest overkill way? :slight_smile:
Maybe a template or macro that I can reuse.
I just want to filter them so I can add up the interest I got.

check the SUMIF() function which should give the answer you're looking for.

Best,

Meant this to go to the list as well (accidentally sent only to Jame on
first reply)...

Expanding on Regina's answer... I routinely use subtotal as she suggests. I
insert a row above the rows of interest then put the subtotal formula above
the column that I want to count or sum.

Set the formula range from the first to last row, not including column
title.

To sum the displayed figures the 1st parameter of the function should be
109, to count the rows displayed the value should be 103.

Turn on Autofilter then filter as desired. The formula updates dynamically
as the displayed rows change.

The formula to sum displayed rows would be =subtotal(109,<range>)
Replace <range> with the correct value, e.g. A2:A25