Instantaneo
New Member
- Joined
- Dec 5, 2012
- Messages
- 28
Hi,
This question started in another topic but since it "jumps out" of it a bit and I figured out one reason for my code not working I'd like to came up with another topic to discuss this specific issue.
I have the following range (small set):
<tbody>
</tbody>
I'm trying to use this code:
This code isn't working (it returns always 0). But now imagine this range:
<tbody>
</tbody>If I use this code...
... my count_1 will return 3.
So, my question is: why isn't COUNTIF working with small values?
Thank you for your help.
This question started in another topic but since it "jumps out" of it a bit and I figured out one reason for my code not working I'd like to came up with another topic to discuss this specific issue.
I have the following range (small set):
Values (avg) |
0,18869 |
0,18788 |
0,16756 |
0,1146 |
0,12558 |
0,18118 |
0,17898 |
0,06433 |
0,1628 |
0,18928 |
<tbody>
</tbody>
I'm trying to use this code:
Code:
Dim pivot_total As Integer Dim range_pivot As String
Dim lim_max As Double
Dim ws As Worksheet
Dim count_1 As Integer
Set ws = Worksheets("KPI") ws.Select
pivot_total = Application.WorksheetFunction.Match("Grand Total", range("K:K"), 0)
range_pivot = "T6:T" & (pivot_total - 1) 'this is the range of those values above
lim_max = 0.2
count_1 = Application.WorksheetFunction.CountIf(ws.range(range_pivot), "<" & lim_max)
MsgBox count_1
This code isn't working (it returns always 0). But now imagine this range:
Values (avg) |
18 |
19 |
17 |
11 |
13 |
17 |
6 |
16 |
18 |
<tbody>
</tbody>
Code:
Dim pivot_total As Integer Dim range_pivot As String
Dim lim_max As Double
Dim ws As Worksheet
Dim count_1 As Integer
Set ws = Worksheets("KPI") ws.Select
pivot_total = Application.WorksheetFunction.Match("Grand Total", range("K:K"), 0)
range_pivot = "T6:T" & (pivot_total - 1) 'this is the range of those values above
lim_max = 15
count_1 = Application.WorksheetFunction.CountIf(ws.range(range_pivot), "<" & lim_max)
MsgBox count_1
... my count_1 will return 3.
So, my question is: why isn't COUNTIF working with small values?
Thank you for your help.
Last edited: