Friday, March 26, 2010

Total Count of Items in a List in Sharepoint


I had a recent assignment to test the performance of a List. The list was behaving really slow and I need to determine the total number of items in the list.
Aaaah ………… there starts the problem. I wanted the total number of items in the list and I could only do that by navigating through the List Item pages which was around 20,000 + Items, So need to click through every single pages and it would take couple of months to figure out the exact numbers. Then I thought about the "Calculated Columns" in Sharepoint.
Finally I figured out to get the total count of the Items in a Sharepoint List. Here are the steps -



Step 1.Create a "Calculated (calculation based on other columns) " column in the List
Step 2.Column Name - "Total"
The Type of Information in this column - "Calculated"
In the Formula Column put - "=SUM(ID)" (without apostrophise)
Select "The data type returned from this formula is: " as Number
Step 3.Select "OK" - a new column will be added to the List and then you could see the Column "Total" which would display values from 1 to End number in ascending order. If you click the header "Total" the list would be displayed in descending order displaying the Total number of the Items in the list.

Now.... however this is not an optimal solution considering that if you delete an item sharepoint still retains the ID and hence it still shows the total count (including the deleted item). So you can use this solution with a variation and use it appropriately.

To fix the total count issue,  there is another solution; You can follow the below steps:

Step 1.
Go to the list, click on the list tab, Click on "Modify View"

Step 2.
Scroll to the bottom of the page, there will be an option called "Totals"
Step 3.
Click on the column which you want to show the count, select count option here it is the "Name column"
Step 4.
Now if you go back to the list, you can see a new column "Count" with the total count of items on it.

Hope this  helps....... Do let me know your feedback .

Also If you are looking to filter a list based on user/Group permission, this post says it http://sharepointlogics.com/2014/02/how-to-filter-sharepoint-list-based-on.html

9 comments:

Kathleen said...

Bless you!! This was exactly what I was trying to do and wandering throughout the web and blogs and posts. Your description is very clear and I was successful in listing the number of items in a folder. Thanks!!

Anonymous said...

Howdy. Great post! I'm working with 2010 and ran into a snag. I need to limit an attendee list to 10 people. My thought was to use this recomendation and then toss some validation to the field. the problem is that the calculated field is only working for items currently in the list. It is not working for new items. Any suggestions?

Anonymous said...

There is a problem.
If some items were deleted from the list, the total count will not reflect the change. The ID was issued to each of the item when it was created and will not changed forever, it seems.

Anonymous said...

Thanks a lot for your nice post ! But I think you must write the formula as "=COUNT(ID)" as your formula will return the cumulative sum and not the number of items.

Cheers,

Fluidetom said...

Hi,

I don't get it.
Why don't you just go to 'View All Site Content' where all lists and libraries are listed? The number of items per list is also displayed there; out of the box...

Have a nice day

Anonymous said...

Thanks!

Anonymous said...

I work with large Sharepoint lists and in order to always know how many rows of items my lists contain, I use the "modify this view" feature while in my list. First, select "modify this view" from the All Items drop down menu. Once the new window opens, scroll to the bottom of the the screen and select the "Totals" button. A new window opens and you are able to "total" any column you wish by selecting "count" in the drop down menu next to each column heading. Click ok. Now when you open your list the count will appear at the top of your list and at the bottom of your list.

Anonymous said...

THANKS !!!! From Belgium Army

Anonymous said...

Great Post! it's exactly that l needed! thanks! a lot!