![]() |
Filtered counts
Can anyone please tell me how i can count the number of rows o
worksheet "Raw" that contain the text "Acorn" in column "E" but only i the cell in column "V" is not empty. Also i would like to copy the row that meets the above criteria to new worksheet called "Checked" TI -- Message posted from http://www.ExcelForum.com |
Filtered counts
Hi
try =SUMPRDUCT(--(E1:E1000="Acorn"),--(V1:V1000<"")) For more about SUMPRODUCT see: http://www.xldynamic.com/source/xld.SUMPRODUCT.html -- Regards Frank Kabel Frankfurt, Germany "Jako " schrieb im Newsbeitrag ... Can anyone please tell me how i can count the number of rows on worksheet "Raw" that contain the text "Acorn" in column "E" but only if the cell in column "V" is not empty. Also i would like to copy the row that meets the above criteria to a new worksheet called "Checked" TIA --- Message posted from http://www.ExcelForum.com/ |
Filtered counts
Thanks for the reply.
Is there a way to do it as a VBA macro / Subroutine? Also i woould like to then create an Add-in for this and other simila processes. Is it the case that they must all be programmed as functions to be abl to use them as Add-Ins? Thank -- Message posted from http://www.ExcelForum.com |
Filtered counts
Hi
why do you want to do it within VBA? this would probably slower! -- Regards Frank Kabel Frankfurt, Germany "Jako " schrieb im Newsbeitrag ... Thanks for the reply. Is there a way to do it as a VBA macro / Subroutine? Also i woould like to then create an Add-in for this and other similar processes. Is it the case that they must all be programmed as functions to be able to use them as Add-Ins? Thanks --- Message posted from http://www.ExcelForum.com/ |
Filtered counts
Don't i have to do it in VBA to create an Add-in that i can share on
numerous computers to people with very basic Excel knowledge? --- Message posted from http://www.ExcelForum.com/ |
Filtered counts
You could loop through the range or use just evaluate the worksheet function:
MsgBox _ ActiveSheet.Evaluate("=SUMPRoDUCT(--(E1:E1000=""Acorn""),--(V1:V1000<""""))") (I added the "o" in sumproduct. <vbg) "Jako <" wrote: Don't i have to do it in VBA to create an Add-in that i can share on numerous computers to people with very basic Excel knowledge? --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
Filtered counts
Is this possible, and if so, how will i put it as an Add-In
-- Message posted from http://www.ExcelForum.com |
Filtered counts
Depends on what your addin is going to do with it.
If you just want to show it to the user, then you can use the msgbox. If you're going to do something else with the value, sub testme dim myVal as long myval = _ ActiveSheet.Evaluate("=SUMPRoDUCT(--(E1:E1000=""Acorn""),--(V1:V1000<""""))") 'do what you want after that end sub "Jako <" wrote: Is this possible, and if so, how will i put it as an Add-In? --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
Filtered counts
Many thanks that works a treat.
Please could you tell me how i can then use this to check all th worksheets of any workbooks in a folder called Audit on the C:. ie C:/Audit. What i want to do is check each workbook (all worksheet therein) i this directory using the function you have provided. TI -- Message posted from http://www.ExcelForum.com |
Filtered counts
Open each of the workbooks and then evaluate the function for each worksheet:
Option Explicit Sub testme01() Dim myFiles() As String Dim fCtr As Long Dim myFile As String Dim myPath As String Dim tempWkbk As Workbook Dim wks As Worksheet Dim myVal As Long Dim oRow As Long Dim RptWks As Worksheet 'change to point at the folder to check myPath = "c:\my documents\excel\test" If Right(myPath, 1) < "\" Then myPath = myPath & "\" End If myFile = Dir(myPath & "*.xls") If myFile = "" Then MsgBox "no files found" Exit Sub End If Application.ScreenUpdating = False Set RptWks = Workbooks.Add(1).Worksheets(1) RptWks.Range("a1").Resize(1, 3).Value _ = Array("workbook Name", "worksheet Name", "value") 'get the list of files fCtr = 0 Do While myFile < "" fCtr = fCtr + 1 ReDim Preserve myFiles(1 To fCtr) myFiles(fCtr) = myFile myFile = Dir() Loop If fCtr 0 Then oRow = 2 For fCtr = LBound(myFiles) To UBound(myFiles) Application.StatusBar = "Processing: " & myFiles(fCtr) Set tempWkbk = Workbooks.Open(Filename:=myPath & myFiles(fCtr)) For Each wks In tempWkbk.Worksheets myVal = _ wks.Evaluate("=SUMPRoDUCT(--(E1:E1000=""Acorn"")," & _ "--(V1:V1000<""""))") With RptWks.Cells(oRow, "A") .Value = tempWkbk.FullName .Offset(0, 1).Value = "'" & wks.Name .Offset(0, 2).Value = myVal End With oRow = oRow + 1 Next wks tempWkbk.Close savechanges:=False Next fCtr End If With RptWks .UsedRange.Columns.AutoFit End With With Application .ScreenUpdating = True .StatusBar = False End With End Sub "Jako <" wrote: Many thanks that works a treat. Please could you tell me how i can then use this to check all the worksheets of any workbooks in a folder called Audit on the C:. ie C:/Audit. What i want to do is check each workbook (all worksheet therein) in this directory using the function you have provided. TIA --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
Filtered counts
FANTASTIC !!
Many thanks that's perfect and far better than what i was asking for a well. Thankyou again for all your advice and time -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 03:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com