Using Aggregate and Index Functions

francoiscj1

New Member
Joined
Aug 21, 2017
Messages
33
Office Version
  1. 365
Platform
  1. Windows
I have an office inventory spreadsheet and the following is what I would like to do:


  • Get a running total for quantity even if I sort any column the running total should not break
  • Get Running total sorted by item and should reset when the item name changes
  • Get running total (for visible rows only) when the table is filtered
I know I can do this using aggregate and index but I can't find a formula online that would work to help me. .



 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
[1]
=SUBTOTAL(9,QuantityRange)

[2]
=SUMPRODUCT(SUBTOTAL(9,OFFSET(SumRange,ROW(SumRange)-ROW(INDEX(SumRange,1,1)),0,1)),--(ItemRange=Item))
 
Upvote 0
Thanks for answering Aladin, but I don't understand the answers you gave. Are you giving me two options for my question?
 
Upvote 0
Thanks for answering Aladin, but I don't understand the answers you gave. Are you giving me two options for my question?


"Get running total (for visible rows only) when the table is filtered"

"Get a running total for quantity even if I sort any column the running total should not break"

=SUBTOTAL(9,QuantityRange)

"Get Running total sorted by item and should reset when the item name changes"

=SUMPRODUCT(SUBTOTAL(9,OFFSET(SumRange,ROW(SumRange)-ROW(INDEX(SumRange,1,1)),0,1)),--(ItemRange=Item))

The last one needs a arnge to sum (hence SumRange).

If these are not what you are looking for, please elaborate.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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