# count function, is that correct?

#### earp_

##### Active Member
i found also this
Quote:
<table border="0" cellpadding="6" cellspacing="0" width="100%"> <tbody><tr> <td class="alt2" style="border: 1px inset ;"> myNum = WorksheetFunction.Count(Range(pIndex & "1").EntireColumn) </td> </tr> </tbody></table>
the 1 means that it starts from the first row right?
instead if I want it to start from the row 2, i just need to put 2 or write
new = myNum - 1, right?

### Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

#### Oaktree

##### MrExcel MVP
It's not clear what you are trying to do.

If pIndex stores "A", Range(pIndex & "1").EntireColumn will select column A. Or, more specifically, Range(pIndex & "1") will read Range("A1") then .EntireColumn selects the whole column of the selected range (A1). So, WorksheetFunction.Count(Range(pIndex & "1").EntireColumn) is equivalent to WorksheetFunction.Count(Range("A:A"))

If you change the "1" to a "2", it won't have an impact on the result, since you're working with .EntireColumn anyway.

new = myNum - 1 will subtract 1 from the returned count. It is different from putting a "2" in WorksheetFunction.Count(Range(pIndex & "1").EntireColumn).... though, putting a "2" or a "1" in the formula does not matter.

#### iliace

##### Well-known Member
pIndex is probably a letter value indicating column, such as "A". Thus,

pIndex = "A"

pIndex & "1" = "A1"

The .EntireColumn makes the reference entire column, such as "A:A" and returns the corresponding range object. This shouldn't matter, generally, since Count only looks at numeric values, and I'm assuming your first row is header?

#### earp_

##### Active Member
pIndex contains "A", right.
I just want to count the elements in A from the second row to the end.
In the first row there is a value that I don't want to consider for counting.
So I guess I can count all the column and then do '-1' for not considering the first row.
Or, if you have any suggests pls let me know.

any suggests?

#### earp_

##### Active Member
it seems that with this it works
numRow = wb.Sheets("daily").Range(pIndex & "1").Count

Replies
10
Views
715
Replies
0
Views
911
Replies
2
Views
144
Replies
5
Views
340
Replies
1
Views
297

1,190,676
Messages
5,982,207
Members
439,768
Latest member
loukrs

### 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.

### Which adblocker are you using?

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

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