# Subtotal with formula not function

#### LisaCU

##### New Member
I have a spreadsheet which has 5 workbooks. The first workbook references the second via Vlookup primarily and the second references the first, third, fourth and fifth again using Vlookup. The second workbook contains almost 10,000 rows which represents 6 months data; the spreadsheet will need to be used cumulatively as it represents a reconciliation.

My problem is that I need to compare totals for individuals according to month; the easy way would be to use the Subtotal function but, unfortunately the spreadsheet appears to have to much data/too many calculations to enable the process to work and therefore I need a formula which will sum data in a list at the point that a reference number changes:

A Employee ID B Month C Amount Total for Month (Calc: =IF(AND(A2=A1,B2=B1),0,C2)

1235 1 25.00
1235 1 15.00 40.00
1235 2 25.00 25.00
1235 3 125.00 125.00
2569 2 25.00
2569 2 15.00 40.00
2569 3 300.00
2870 3 25.00 325.00

What I then need is a calculation that will give me a total for employee 1235 for months 1, 2 and 3 and then the same for the other employees.

I hope I have explained this in a way that makes sense and any help you can give will be much appreciated.

(really sorry but I can't get the columns to line up when I post the thread)

Last edited:

### Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Something like this will work.

=SUMIFS(C:C,A:A,1235,B:B,">=1",B:B,"<=3")

You can substitute the value 1235 with a cell reference that contains the value 1235.

I should advice to use a pivot table for that kind of work.

Something like this will work.

=SUMIFS(C:C,A:A,1235,B:B,">=1",B:B,"<=3")

You can substitute the value 1235 with a cell reference that contains the value 1235.

Thank you for taking the time to reply Unfortunately that won't work as I need the SumIF() to refer to a change in reference number rather than responding to a specific reference number i.e. I need a total for 1235 and then 2569 then 2870 and so on and the data file is several thousand rows. To add to the problem this is a reconciliation so the reference numbers will not necessarily be the same each time the reconciliation is done and the number of rows may well be different as well

I should advice to use a pivot table for that kind of work.

Normally that would be perfect but I have to compare data in 2 workbooks - the smallest is 3000+ rows and 23 columns and the largest is 10,000+ rows and 26 columns

Then as Oeldere noted, a PivotTable sounds like your best bet.

Replies
4
Views
227
Replies
1
Views
302
Replies
6
Views
801
Replies
5
Views
192
Replies
11
Views
440

1,221,127
Messages
6,158,100
Members
451,464
Latest member
Holden3

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

### Which adblocker are you using?

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

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