6 replies
by peyison
I don't think there's a way to make CountIf work across multiple sheets. Here's two options that might work:
1) On sheet 255 create a list of links to each of the other sheet's cell A12 - so all of the values would be on one sheet. You could thenuse CountIf on this range.
2) Write your own function to do this. Add the following code to a code module in your workbook:
Function Count3D(aiFirstSheet As Integer, aiLastSheet As Integer, _
asCell As String, asValue As String) As Integer
'aiFirstSheet and aiLastSheet are the sheet numbers of the first and last sheets to check
'asCell is the cell address of the cell to check
'asValue is the value in the cell that you want to check for
' only cells that contain this value will be included in the count
Dim I As Integer
Dim iCount As Integer
'this causes Excel to recalculate the function whenever the sheet recalcs
Application.Volatile True
'loop through the sheets and check for the desired value in the specified cell
'you can use UCase() to make the check not case sensitive
For I = aiFirstSheet To aiLastSheet
If ActiveWorkbook.Worksheets(I).Range(asCell).Value = asValue Then
iCount = iCount + 1
End If
NextCount3D = iCount
End Function
In the cell that you want the count to be displayed in, enter:
=Count3D(1, 254, "A12", "yes")
Hope this helps.
by kilo watt
The linking is too labor intensive and counters the efficiency of using a formula.
The code module answer is too far over my head to understand. My users need something closer to plain English, they are not programmers.
by c_m_s
Hi there,
Before starting make a backup copy of your workbook.
1. Locate a cell that is blank on all sheets (example C13).
2. Select the Sheet1 tab, press and hold "Shift", and select the tab of the last sheet (254).
3. Select the blank cell identified in step 1 (C13).
4. Type "=if(A12 = "Yes", 1)" w/o quotes.
5. On sheet 255 select the cell that you want the total to appear in. Type
"=Sum(sheet1:sheet254!A12)" w/o quotes.
Good Luck,
Mike
by kilo watt
This discussion is closed to new replies.
Trending Software posts
Sort by Trending