Cakz Primz
Board Regular
- Joined
- Dec 4, 2016
- Messages
- 102
- Office Version
- 365
- Platform
- Windows
Dear all,
I need to count based on 3 criteria, in a userform:
1. based on system number = TextBox1.Value
2. based on status "Active"
3. based on remarks, if not equal to "Exception"
with this code below:
it gave me the result = 5, but the correct result should be 4, as we have 1 Exception
And when I am trying to use this code below, it gave me an error, in "Exception":
How is the correct syntax to count if not equal to "Exception"?
Thanks in advance.
Prima Indonesia
I need to count based on 3 criteria, in a userform:
1. based on system number = TextBox1.Value
2. based on status "Active"
3. based on remarks, if not equal to "Exception"
with this code below:
VBA Code:
TextBox5.Value = Application.WorksheetFunction.CountIfs(Sheets("PLREP").Range("B8:B150000"), TextBox1.Value, Sheets("PLREP").Range("G8:G150000"), "Active") - Application.WorksheetFunction.CountIfs(Sheets("PLREP").Range("B8:B150000"), TextBox1.Value, Sheets("PLREP").Range("G8:G150000"), "Active")
And when I am trying to use this code below, it gave me an error, in "Exception":
Code:
TextBox5.Value = Application.WorksheetFunction.CountIfs(Sheets("PLREP").Range("B8:B150000"), TextBox1.Value, Sheets("PLREP").Range("G8:G150000"), "Active") - Application.WorksheetFunction.CountIfs(Sheets("PLREP").Range("B8:B150000"), TextBox1.Value, Sheets("PLREP").Range("G8:G150000"), "Active", Sheets("PLREP").Range("AQ8:AQ150000"), <>"Exception")
Thanks in advance.
Prima Indonesia