VBA to filter list for each unique value

Yamezz

Active Member
Joined
Nov 22, 2006
Messages
260
Office Version
  1. 2019
I don't even know where to begin searching for a solution to this, so hopefully someone can point me in the right direction.

I have a bunch of records consisting of a date, an account and a value. Once my code filters the list for the date period I'm interested in, I'd like to then filter the remaining results by account, then transfer that account name and its SUBTOTAL(9,xxx) value to another sheet. How can I get the code to step through each unique account? In one period I may have accounts X, Y, and Z, but another period it may just be X and Z, or A, B and C.

I guess I need something along the lines of:
For each unique value in filtered list
Filter further for unique value #1
Copy unique value #1 and it's SUBTOTAL value to Report sheet
Next unique value

Hopefully that explanation makes sense.
Thanks.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Yamezz

Active Member
Joined
Nov 22, 2006
Messages
260
Office Version
  1. 2019
I'm not sure how to attach a workbook, but here's a screenshot.



Thanks.
 

SRIKANTHBENONI

New Member
Joined
Jun 30, 2010
Messages
46
So, if you set filter on date and with the date as "01/09/2014" (Example), you want code to copy the table and paste it in another table? Also, do you want name of the sheet to be anything?
 

Yamezz

Active Member
Joined
Nov 22, 2006
Messages
260
Office Version
  1. 2019
I need to do something different. I know how to do what you describe, but what I want to do is filter for a date period (say August 1st to 20th), then see what accounts were present in that time period, filter for each one of the accounts and finally copy the sum of each account for each time period with the Subtotal(9, function.

Thanks.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,110
Messages
5,835,439
Members
430,357
Latest member
RadStorm20

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
Top