Based on your groups of 0-40, 40-80 etc, I expect that either the max value is
less than 400 or there are 11 groups. In my example I'll use a maximum value smaller than 400, but it's easy to adjust if you want 11 groups or if you want to e.g. include 400 in the last group.
You could do something like this:
Dim array = New Decimal() {10, 20, 30, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370, 380, 390}
Dim groups = New List(Of IEnumerable(Of Decimal))
For index As Integer = 0 To 9
Dim lowerBound = index / 10 * 400
Dim upperBound = (index + 1) / 10 * 400
groups.Add(array.Where(Function(n) (n >= lowerBound And n < upperBound)))
Next
Dim averages = groups.Select(Function(g) If(g.Count > 0, g.Average(), -1))
"array" holds a number of values with min 0 and max <400.
"groups" holds groups with values 0 to 40, 40 to 80 etc.
"averages" holds the average of each of these groups, or -1 if the group is empty.
If you don't care about the empty groups (40-80 in my code example), you could do this more elegantly:
Dim groups = array.GroupBy(Function(n) Math.Floor(n / 40))
Dim averages = groups.Select(Function(g) g.Average())