Recalculate cells after autofilter

honkin

Active Member
Joined
Mar 20, 2012
Messages
385
Office Version
  1. 2016
Platform
  1. MacOS
I have a sheet which records profit and loss for horse racing and I am wondering how it would be possible to have the Total Win Equity (CR) be dynamic.

So it is an ongoing tally of the profit plus the starting bank. These are the formulas =CR18+AD19 AD is the Profit or Loss. So it adds the profit of the current row + the Total Win Equity of the row above to show the current equity. The sheet has quite a lot of filters and when autofiltering is applied, naturally the Total Win Equity becomes incorrect, as not every row is there. I actually want that column to have the ability to tally what is visible, so CR of the row above + AD of the current row.

Is it at all possible that this can happen? I have been trying to think of a solution, but have come up short. Even SUBTOTAL doesn't see to cover it as whatever rows are visible will always need to reference the previous visible row and not just the previous numerical row. Does that make sense at all?

As you see here

2018 Latest Results June 2021.xlsb
CR
17Total Win Equity
1810303.8
1910203.8
2010103.8
2110003.8
229903.8
239803.8
319003.8
328903.8
sheet1
Cell Formulas
RangeFormula
CR18CR18=AD18+10000
CR31:CR32,CR19:CR23CR19=CR18+AD19


So the rows down to 23 are consecutive but I have hidden rows 24-30, just as may happen with autofiltering. Notice how the figure in row 31 has dropped substantially from that in row 23? The goal would be to have thing recalculate so that the accurate figures show in each cell

Hopefully it is achievable.

Thanks in advance
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Another option
Excel Formula:
=AGGREGATE(9,7,AD$18:AD18)+10000
 
Upvote 0
Also with SUBTOTAL
Excel Formula:
=10000+SUBTOTAL(109,AD$18:AD18)
 
Upvote 0
Solution
Another option
Excel Formula:
=AGGREGATE(9,7,AD$18:AD18)+10000
Looks like 2 ways to skin this cat, Fluff. This appears to work fine, as does Peter_SSs' solution

Thanks so much. Not really sure how I mark the solution, with both giving identical results
 
Upvote 0
Also with SUBTOTAL
Excel Formula:
=10000+SUBTOTAL(109,AD$18:AD18)
Cheers Peter_SSs
As I indicated to Fluff, there is obviously 2 ways to handle this, with both solutions giving identical results, even when the sheet is autofiltered.

I'm unsure how to mark both solutions as correct, so would love some advice how I achieve that

cheers
 
Upvote 0
cheers
Hi Honkin,

Does this help?

Honkin7.xlsx
ADAEAFCQCR
17AD18 onFilter10000
18100110100
19200110300
20300110600
21400111000
22500111500
23600112100
2470012800
2580013600
2690014500
27100015500
28110016600
29120017800
30130019100
311400120500
321500122000
Sheet1
Cell Formulas
RangeFormula
AD19:AD32AD19=AD18+100
CR18:CR32CR18=AGGREGATE(9,7,AD18)+INDEX(CR:CR,AGGREGATE(14,7,ROW($CR$17:$CR17),1))
Cheers Toadstool, but not really keen to look at a helper column, so will look to other solution. Thanks so much for your reply
 
Upvote 0
I'm unsure how to mark both solutions as correct, so would love some advice how I achieve that
You can only mark one. Some choices would be ..
  • The one you chose to use, perhaps because you understand it better or feel you could modify it easier if required later
  • The one that was posted first
  • Toss a coin
  • ....
Neither Fluff nor I will be offended if you mark the other's post. :)

Main thing is that you got something that worked for you. (y)
 
Upvote 0
You can only mark one. Some choices would be ..
  • The one you chose to use, perhaps because you understand it better or feel you could modify it easier if required later
  • The one that was posted first
  • Toss a coin
  • ....
Neither Fluff nor I will be offended if you mark the other's post. :)

Main thing is that you got something that worked for you. (y)
Thanks for your reply Peter. I have not currently chosen which one to choose. I had put both solutions in columns side by side to test how they performed when autofiltering, which was how I saw they were identical.

As for the one posted first, it is pretty tight, with both being posted within 20 minutes of each other. I just did it the scientific way and tossed a coin. My thanks to both of you, as it is invaluable

cheers
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,195
Members
453,021
Latest member
pingpong7117

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