JohnnyAngel
Board Regular
- Joined
- Apr 18, 2011
- Messages
- 65
All,
I need the filter VBA macro code assigned to each filter in the DB tab to be modified to clear the filter from the DATA Tab when "ALL" is selected. Right now, it filters all other selections, but when I select "ALL", the DATA Tab still shows the database filtered and I need it to show all records when nothing is selected from all (3) drop down menus of each filter.
Additionally, I need the #1) COUNTIF Array formula to be modified as follows:
#1)
Change This: {=(COUNT(IF(RngVal1>=$G$19,IF(RngVal1<=$G$18,1,0))))/G15}
To Something LIke This: {=(COUNT(IF(SUBTOTAL(3,OFFSET(RngVal1>=$G$19,IF(RngVal1<=$G$18,1,0))))/G15}
I want the above array formula to look something like the array formula below, so I can test the accuracy of its count because #1 & #2 are returning different results.
#2)
=SUMPRODUCT(SUBTOTAL(3,OFFSET(RngVal1,ROW(RngVal1)-MIN(ROW(RngVal1)),,1)),--(RngVal1>=$G$19),--(RngVal1<=$G$18)/G15
The Problem:
The 1st formula is counting 164 instances. The 2nd formula one is counting 141. I need to find out which one is accurate and is going to be the best solution for when the database is filtered. Bottomline, when the filters are set, the COUNTIFS array formula with multiple conditions, should return the correct count according to the filtered data scope.
For instance, if the filter returns 10 records, the COUNTIF array should tell me how many of those 10 records meet the criteria from the COUNTIFS Array Formula that contains the multiple conditions.
I have attached the XL file with more clarification and questions regarding this initiative.
Thanks,
I need the filter VBA macro code assigned to each filter in the DB tab to be modified to clear the filter from the DATA Tab when "ALL" is selected. Right now, it filters all other selections, but when I select "ALL", the DATA Tab still shows the database filtered and I need it to show all records when nothing is selected from all (3) drop down menus of each filter.
Code:
Option Explicit
Sub Filter1()
With Sheets("DATA")
If .FilterMode Then .ShowAllData
.Range("B3").AutoFilter
.Range("$B$3").CurrentRegion.AutoFilter Field:=1, _
Criteria1:=Range("Filter1").Cells(Sheets("DB").Cells(1, 1).Value)
End With
End Sub
Sub Filter2()
With Sheets("DATA")
If .FilterMode Then .ShowAllData
.Range("B3").AutoFilter
.Range("$B$3").CurrentRegion.AutoFilter Field:=2, _
Criteria1:=Range("Filter2").Cells(Sheets("DB").Cells(2, 1).Value)
End With
End Sub
Sub Filter3()
With Sheets("DATA")
If .FilterMode Then .ShowAllData
.Range("B3").AutoFilter
.Range("$B$3").CurrentRegion.AutoFilter Field:=3, _
Criteria1:=Range("Filter3").Cells(Sheets("DB").Cells(3, 1).Value)
End With
End Sub
Additionally, I need the #1) COUNTIF Array formula to be modified as follows:
#1)
Change This: {=(COUNT(IF(RngVal1>=$G$19,IF(RngVal1<=$G$18,1,0))))/G15}
To Something LIke This: {=(COUNT(IF(SUBTOTAL(3,OFFSET(RngVal1>=$G$19,IF(RngVal1<=$G$18,1,0))))/G15}
I want the above array formula to look something like the array formula below, so I can test the accuracy of its count because #1 & #2 are returning different results.
#2)
=SUMPRODUCT(SUBTOTAL(3,OFFSET(RngVal1,ROW(RngVal1)-MIN(ROW(RngVal1)),,1)),--(RngVal1>=$G$19),--(RngVal1<=$G$18)/G15
The Problem:
The 1st formula is counting 164 instances. The 2nd formula one is counting 141. I need to find out which one is accurate and is going to be the best solution for when the database is filtered. Bottomline, when the filters are set, the COUNTIFS array formula with multiple conditions, should return the correct count according to the filtered data scope.
For instance, if the filter returns 10 records, the COUNTIF array should tell me how many of those 10 records meet the criteria from the COUNTIFS Array Formula that contains the multiple conditions.
I have attached the XL file with more clarification and questions regarding this initiative.
Thanks,