Count Line Items in a Table

BrianExcel

Well-known Member
Joined
Apr 21, 2010
Messages
975
I am trying to count the number of line items in a table. When I am in the worksheet and enter COUNT(A2:A52) it results in 0.

But when I look at the formula, instead of the count and range, I see:

=COUNT(SevenDaySummaryData[Venue])

This is because it's a table and the header value is "Venue".

How can I do a simple count in the table that won't show as 0?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Sounds like the data in that column might be text and not numerical. Try

=COUNTA(SevenDaySummaryData[Venue])
 
Upvote 0
time to learn

 
Last edited:
Upvote 0
Thanks Peter! That worked perfectly.

One more question - how do I then massage that into VBA to use worksheet function? I have it currently set as Double, with the following:

dim VenueCount as Double
VenueCount = WorksheetFunction.COUNTA(SevenDaySummaryData[Venue])

When I do that it highlights the "[Venue]" and then says "expected ("
 
Upvote 0
Since the count will be a whole number, I would declare VenueCount as Long, not Double (though that has nothing to do with your error).
Try

VenueCount = WorksheetFunction.CountA(Range("SevenDaySummaryData[Venue]"))
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,094
Latest member
teemeren

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top