ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populated Cells In A Named Range (https://www.excelbanter.com/excel-programming/297345-populated-cells-named-range.html)

Bob Barnes[_3_]

Populated Cells In A Named Range
 
I am an Access Programmer using automation to Excel

In a Named Range of 12 cells, is there a function to tel
how many of those cells have entries greater than Zero

I could code that w/ many IF statements, but would lik
to know if a function exists

TIA - Bob

Jim Rech

Populated Cells In A Named Range
 
In a worksheet that would be accomplished with a formula like this:

=COUNTIF(RangeName,"0")

So presumably

xlApp.CountIf(XL.Range("RangeName"), "0")

would return the count via automation.
--
Jim Rech
Excel MVP
"Bob Barnes" wrote in message
...
|I am an Access Programmer using automation to Excel.
|
| In a Named Range of 12 cells, is there a function to tell
| how many of those cells have entries greater than Zero?
|
| I could code that w/ many IF statements, but would like
| to know if a function exists.
|
| TIA - Bob



William Ryan eMVP

Populated Cells In A Named Range
 
You can invoke the CountIF function like this:
=COUNTIF(RangeName,"0")
"Bob Barnes" wrote in message
...
I am an Access Programmer using automation to Excel.

In a Named Range of 12 cells, is there a function to tell
how many of those cells have entries greater than Zero?

I could code that w/ many IF statements, but would like
to know if a function exists.

TIA - Bob




onedaywhen

Populated Cells In A Named Range
 
"Bob Barnes" wrote in message
...
|I am an Access Programmer using automation to Excel.
|
| In a Named Range of 12 cells, is there a function to tell
| how many of those cells have entries greater than Zero?
|


As a MS Access developer you will be please to learn that you don't
need automation to access read cell values, you can access the names
range as if it were a Jet table. This is how the query would look like
from a MS Access query's SQL window:

SELECT
Count(MyKeyColumn)
FROM
[Excel 8.0;database=C:\MyWorkbook.xls;].[MyNamedRange]
GROUP BY
MyKeyColumn
HAVING
INT(MyKeyColumn) 0
;

--


All times are GMT +1. The time now is 03:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com