Hello kmfdm515,
The easiest approach is to use a UDF (User Defined Function) to do this across multiple sheets. Here is the code and instructions on how to install and use the UDF.
UDF Macro Code
Public Function GetPercentCnt(RefCell_Addx As String, Compare_Flag As String, Percent_Value As Double) As Long
Dim N As Long
Dim Wks As Worksheet
For Each Wks In Worksheets
Select Case Compare_Flag
Case Is = "<="
If Wks.Range(RefCell_Addx) <= Percent_Value Then N = N + 1
Case Is = "<"
If Wks.Range(RefCell_Addx) < Percent_Value Then N = N + 1
Case Is = "="
If Wks.Range(RefCell_Addx) = Percent_Value Then N = N + 1
Case Is = ">"
If Wks.Range(RefCell_Addx) > Percent_Value Then N = N + 1
Case Is = ">="
If Wks.Range(RefCell_Addx) >= Percent_Value Then N = N + 1
End Select
Next Wks
GetPercentCnt = N
End Function
Installing the UDF Code
1. Copy the code above using CTRL+C
2. Open your Workbook in Excel.
3. Right Click on the Name Tab of any Worksheet.
4. Click View Code in the pop up menu.
5. Press ALT+I to activate the Insert menu.
6. Press the letter m.
7. Paste the code into the module using CTRL+V
8. Save the UDF code using CTRL+S
9. Press ALT+Q to return to Excel.
Using the UDF
This function takes 3 arguments:
RefCell_Addx - A string indicating the cell you want to check
Compare_Flag - A string indicating the type of compare to perform. There are five strings "<=", "<", "=", ">", ">="
Percent_Value - Number expressed as a valid percentage.
Example
'Sheet5 cell B1 has the formula
=GetPercentCnt("A1", ">=", 90%)
'Sheet5 cell B2 has the the formula
=GetPercentCnt("A2", ">=", 90%)
Sincerely,
Leith Ross
Bookmarks