Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting Cells
Hi
What code should I write in order to count only the positive value of a pre-defined range: Range(Cells(42, 2), Cells(77, 2)) Thanks Pedro |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting Cells
Total = 0
For J = 42 to 77 If Cells(J, 2).Value 0 Then Total = Total + Cells(J, 2).Value Next J -----Original Message----- Hi What code should I write in order to count only the positive value of a pre-defined range: Range(Cells(42, 2), Cells(77, 2)) Thanks Pedro . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting Cells
Thinking about it if you only want to count the number of
cells rather than sum them you should use application.worksheetfunction.countif -----Original Message----- Hi What code should I write in order to count only the positive value of a pre-defined range: Range(Cells(42, 2), Cells(77, 2)) Thanks Pedro . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting Cells
Thanks Nick
I tried to use the application.worksheetfunction.countif Using strRet = Application.WorksheetFunction.CountIf((Range(Cells (42, 2), Cells(77, 2))), Cells.Value 0) But it gives me an error. Do you know what do I have to change? "Nick" wrote in message ... Thinking about it if you only want to count the number of cells rather than sum them you should use application.worksheetfunction.countif -----Original Message----- Hi What code should I write in order to count only the positive value of a pre-defined range: Range(Cells(42, 2), Cells(77, 2)) Thanks Pedro . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting Cells
One command, no looping required.
Application.WorksheetFunction.CountIf(Range(Cells( 42, 2), Cells(77, 2)),"0") -----Original Message----- Hi What code should I write in order to count only the positive value of a pre-defined range: Range(Cells(42, 2), Cells(77, 2)) Thanks Pedro . |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting Cells
FWIW:
The worksheet function is: =COUNTIF(B42:B77,""&0) HTH "Pedro Marques" wrote in message ... Thanks Nick I tried to use the application.worksheetfunction.countif Using strRet = Application.WorksheetFunction.CountIf((Range(Cells (42, 2), Cells(77, 2))), Cells.Value 0) But it gives me an error. Do you know what do I have to change? "Nick" wrote in message ... Thinking about it if you only want to count the number of cells rather than sum them you should use application.worksheetfunction.countif -----Original Message----- Hi What code should I write in order to count only the positive value of a pre-defined range: Range(Cells(42, 2), Cells(77, 2)) Thanks Pedro . |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting Cells
And if he *does* want to sum them, he can use SUMIF <g.
On Thu, 24 Jul 2003 03:38:53 -0700, "Nick" wrote: Thinking about it if you only want to count the number of cells rather than sum them you should use application.worksheetfunction.countif -----Original Message----- Hi What code should I write in order to count only the positive value of a pre-defined range: Range(Cells(42, 2), Cells(77, 2)) Thanks Pedro . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Counting the number of cells between 2 seperate cells | Excel Discussion (Misc queries) | |||
counting cells that are 0 in a range of non-contiguous cells | Excel Worksheet Functions | |||
Query counting cells in a row that exactly match cells in another | Excel Discussion (Misc queries) | |||
Complicated counting of cells (based on other cells contents) | Excel Worksheet Functions | |||
Counting empty cells within a range of cells | New Users to Excel |