Filter and Sum based on inputs vba code

cgsierra

Board Regular
Joined
Mar 21, 2011
Messages
142
Office Version
  1. 365
Hello,
Can someone please help me with a vba code to filter a tab called "Raw Data" with the multiple dynamic values I enter in another sheet?
ie.
Sheet 1
cell L2 "LE", cells L2:O2 is where I would enter the values for LE, corresponding column in the "Raw Data" tab is A
cell L3 "RU", cells L3:O3 is where I would enter the values for RU, corresponding column in the "Raw Data" tab is B
cell L4 "SL", cells L4:O4 is where I would enter the values for SL, corresponding column in the "Raw Data" tab is C
cell L5 "GTM", cells L5:O5 is where I would enter the values for GTM, corresponding column in the "Raw Data" tab is D
cell L6 "Location", cells L6:O6 is where I would enter the values for Location, corresponding column in the "Raw Data" tab is E
cell L7 "Department", cells L7:O7 is where I would enter the values for Department, corresponding column in the "Raw Data" tab is F

Sheet 1 will be copied over a few times and renamed for scenario analysis (although all iterations will always reference the same raw data tab) so the code would have to run based on the active sheet instead of a fixed sheet name.

Once the Raw Data is filtered, the macro would sum column K (visible cells only) and place the result in cell Q7 of Sheet 1

Please help
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hello,
Can someone please help me with a vba code to filter a tab called "Raw Data" with the multiple dynamic values I enter in another sheet?
ie.
Sheet 1
cell K2 "LE", cells L2:O2 is where I would enter the values for LE, corresponding column in the "Raw Data" tab is A
cell K3 "RU", cells L3:O3 is where I would enter the values for RU, corresponding column in the "Raw Data" tab is B
cell K4 "SL", cells L4:O4 is where I would enter the values for SL, corresponding column in the "Raw Data" tab is C
cell K5 "GTM", cells L5:O5 is where I would enter the values for GTM, corresponding column in the "Raw Data" tab is D
cell K6 "Location", cells L6:O6 is where I would enter the values for Location, corresponding column in the "Raw Data" tab is E
cell K7 "Department", cells L7:O7 is where I would enter the values for Department, corresponding column in the "Raw Data" tab is F

Sheet 1 will be copied over a few times and renamed for scenario analysis (although all iterations will always reference the same raw data tab) so the code would have to run based on the active sheet instead of a fixed sheet name.

Once the data is filtered, the macro would sum column K in the Raw Data tab (visible cells only) and place the result in cell Q7 of Sheet 1

Please help

above verbiage corrected. Also, the values entered in Sheet 1 may include a * wildcard which would mean "All" or no filter
 
Last edited:
Upvote 0
above verbiage corrected. Also, the values entered in Sheet 1 may include a * wildcard which would mean "All" or no filter

Hello,
please let me know if there is anything additional that I can provide. Not sure if the explanation of the vba code that I am looking for was clear.
thank you kindly for your help
Carlo
 
Upvote 0
Cross posted https://www.excelforum.com/excel-pr...sum-based-on-inputs-vba-code.html#post4903504

Cross-Posting
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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