I have a .csv file that populates into a list box and (with some much appreciated help from Tim), I extract and display stats such as; Max, Min, Average, Range, and Total of the entire data column (Column1). Now, I would like to take it further and run the stats on sections of the data. I would like to click DAILY, WEEKLY, OR MONTHLY buttons and have the stats update respectively. Example - I load 3 months of data but I would like to look at Daily stats of the data. I click the DAILY button and the stats update showing the first day (excluding the rest of the data). I would then click a NEXT button to look at the next day, and so on. This is scientific data from a logger and the CSV file looks like this:

01/26/2015 3:00 am, 1.97

01/26/2015 3:15 am, 3.97

01/26/2015 3:30 am, 0.88

… and so on

My current code for reading ALL of the data looks like this.

[code] Dim Sum, Mn, Mx, Rn, Avg, d As Double

Dim i, Size As Integer

Size = ListBox2.ListCount - 1

Sum = 0.0

For i = 0 To Size

d = CDbl(ListBox2.Cell(i, 1))

Sum = Sum + d

Mx = Max(Mx, d)

Mn = Min(Mn, d)

Rn = Mx-Mn

Avg = Sum/Size

if i = 1 then Mn = d // special case to initialize Min value

Next

MainWindow.Maximum_Value.Text = Str(Mx, “###,###.##”)

MainWindow.Minimum_Value.Text= Str(Mn,"###,###.##")

MainWindow.Total_Value.Text=Str(Sum, “###,###.##”)

MainWindow.Range_Value.Text=Str(Rn, “###,###.##”)

MainWindow.Average_Value.Text=Str(Avg,"###,###.##")[/code]

Thanks in advance!

John