Macro to filter by 3 parameters / Excel 2002 / WinXP

Freewheel

New Member
Joined
Dec 7, 2005
Messages
20
Hi,

I have a filtering problem that I am unable to solve.

I have a number of source data worksheets, one for each country. Each country datasheet contains invoice data. I then have a statistics worksheet on which I want to pull out various data elements, as filtered by:
a) a drop-down list to select the country
b) entering an "activity period" which limits the invoices to those within two dates.

Here is some sample source data, for the UK worksheet:
Invoices sample.xls
ABCDEF
1InvoiceActivity periodPayment
2ReferenceFromToAmount invoicedAmount paid
3UK-00101/06/200531/08/200582,231.20 82,231.20
4UK-00201/06/200531/08/2005204,494.03 204,494.03
5UK-00301/06/200531/08/200555,296.00 55,296.00
6UK-00404/07/200531/08/20050.00 0.00
7UK-00501/06/200531/08/2005148,539.58 148,539.58
8UK-00601/06/200531/08/2005401,314.46 401,314.46
9UK-00701/06/200531/08/2005179,577.94 179,577.94
10UK-00804/07/200531/08/20050.00 0.00
11UK-00901/06/200531/08/2005228,321.67 228,321.67
12UK-01001/06/200531/08/2005301,150.69 301,150.69
13UK-01101/06/200531/08/2005100,462.68 100,462.68
14UK-01204/07/200531/08/2005
15
United Kingdom


... and here is the Statistics sheet on which I want to produce summarised/filtered data. The country-selector drop-down box is in cell B4; the activity period is selected in cells C4 and D4. I want to pull out the reference number, amount invoiced and amount paid for each matching invoice:
Invoices sample.xls
ABCDE
1
2Select countrySelect activity period
3FromTo
4Austria01/06/200531/08/2005
5
6Invoice ref.Amount invoicedAmount Paid
7
8
9
10
11
12
13
14
15
16
17
Statistics


I have been trying to use formulae to achieve this, but to no avail. I set named ranges for each country worksheet, and used a combination of INDEX, OFFSET, INDIRECT and MATCH. The problem is I only get the first exact match, while I want to pull out all matching invoices for a given country/activity period, and have them listed from row 7 downwards. I suspect I need to use some kind of VBA code filter, but I haven't a clue where to start....

With kind regards,
Simon
 
I can't reproduce the error with those headings if I filter the list manually. What happens if you try it on the chosen sheet?
 
Upvote 0

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
If I manually apply a custom autofilter to the United Kingdom sheet, and set:
- dates greater than 1/06/05 in the From field
- dates less than 1/08/05 in the To field

...it works fine. Is that what you meant?

Would it help if I sent you the file?
 
Upvote 0
I've figured it out :biggrin:
Just a stupid mistake that came from too long staring at the screen.

Many thanks for your help Andrew!
 
Upvote 0

Forum statistics

Threads
1,215,338
Messages
6,124,358
Members
449,155
Latest member
ravioli44

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