This project has moved and is read-only. For the latest updates, please go here.

Get average column count

Oct 15, 2012 at 11:36 AM
Edited Oct 15, 2012 at 11:40 AM

What's the easiest method to get the average column count?

I need to know it because i want to know when the report starts (there are some lines above that don't belong to the report itself).

I would like to know how to achieve following with LINQ:

Dim totalColumnCount As Int32 = 0
For r = 1 To ws.Dimension.End.Row
    Dim row = ws.Cells(r, 1, r, ws.Dimension.End.Column)
    totalColumnCount += row.Count()
Next
Dim avgCount = CInt(Math.Round(totalColumnCount / ws.Dimension.End.Row, MidpointRounding.AwayFromZero))