Countif match

joshbrfc

New Member
Joined
Jan 17, 2022
Messages
25
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I want to count the quantity of entries in a row on a specific tab in a workbook based on the match of someones name.

So this is the master data tab.

1707828289178.png


Then i have separate tabs.

And i want it to match with the name cell and the quantity of data entries.

1707828275512.png



Hope that makes sense.

Would Lookup be better?

So it updates automatically when another data entry is added.

Any help greatly appreciated. It's part of trying to improve right first time :) Want a tracker to focus on who needs training more and quick overview.
 

Attachments

  • 1707828159604.png
    1707828159604.png
    2.4 KB · Views: 8
  • 1707828179629.png
    1707828179629.png
    3.9 KB · Views: 8
this is the one I sent;
Function CountEntries(Employee_Name As String)
Dim WS As Worksheet
Dim Entries As Long
For Each WS In ThisWorkbook.Worksheets
If Not WS.Name = ActiveSheet.Name Then
If WS.Range("B3") = "Employee" Then
If WS.Range("F3") = Employee_Name Then
CountEntries = Application.WorksheetFunction.CountA(WS.Range(WS.Range("B20"), WS.Range("b20").End(xlDown)))
Exit Function
End If
End If
End If
Next
End Function

in your pic you have this lines in the wrong place
CountEntries = Application.WorksheetFunction.CountA(WS.Range(WS.Range("B20"), WS.Range("b20").End(xlDown)))
Exit Function
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
this is the one I sent;
Function CountEntries(Employee_Name As String)
Dim WS As Worksheet
Dim Entries As Long
For Each WS In ThisWorkbook.Worksheets
If Not WS.Name = ActiveSheet.Name Then
If WS.Range("B3") = "Employee" Then
If WS.Range("F3") = Employee_Name Then
CountEntries = Application.WorksheetFunction.CountA(WS.Range(WS.Range("B20"), WS.Range("b20").End(xlDown)))
Exit Function
End If
End If
End If
Next
End Function

in your pic you have this lines in the wrong place
CountEntries = Application.WorksheetFunction.CountA(WS.Range(WS.Range("B20"), WS.Range("b20").End(xlDown)))
Exit Function
That's strange, it works now, it's just not automatically updating. I have to press enter on the name cell to update it.

Wondering if there's a way i can an update button.

Thanks for your replies, really really appreciate it.
 
Upvote 0
That's strange, it works now, it's just not automatically updating. I have to press enter on the name cell to update it.

Wondering if there's a way i can an update button.

Thanks for your replies, really really appreciate it.
User defined functions are NOT volatile, by default.
But you can add a line of code to make them so.
See here: Volatile Functions in Excel VBA
 
Upvote 0
You just add it in the code of your function in VBA, as shown in the link I provided you:
Rich (BB code):
Function CountEntries(Employee_Name as String)
    Application.Volatile
    ...
 
Upvote 0
You just add it in the code of your function in VBA, as shown in the link I provided you:
Rich (BB code):
Function CountEntries(Employee_Name as String)
    Application.Volatile
    ...
Thanks for the reply again.

I have added.

1710194234418.png

It's still not working. I'm still having to press enter in the cell for it to update.
 
Upvote 0
How exactly is the data in your workbook being updated?
Manually?
Via links?
 
Upvote 0
How exactly is the data in your workbook being updated?
Manually?
Via links?
Manually.

So on the relevant tab below. So eg employee LF has their tab and it doesn't auto update until i go in the employee cell on master data tab and click in then press enter.

1710254712407.png
 
Upvote 0
The values in column B and being manually updated?
When/how is that happening?

Also, do you have automatic calculations enabled?

And what is the name of the module you have placed this User Defined Function in?
 
Upvote 0
The values in column B and being manually updated?
When/how is that happening?

Also, do you have automatic calculations enabled?

And what is the name of the module you have placed this User Defined Function in?
Sorry, results in column B are not being manually updated. They are updated after the individual tabs are updated.

So

LF's tab is updated manually as and when an error occurs.

1710355885796.png


And based off the entries in Column B on the respective tab.... 5 in this instance... this will populate the master data tab

1710355976121.png


See count entries formula... which thanks to @Shloime is working with

1710356052215.png





As you can see i have added your application.volatile line in, however unfortunately it's still not auto populating.

I am having to into master data and enter the employee cell and press enter for the count entries in column b to update.
 
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,991
Members
449,094
Latest member
masterms

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