If date[[i, 6]] == 1 is True, then it will trigger solarcalc[[1, 2]] += solardata[[i, 3]] every time, for every line. That is why all position 2 are the same. Notice that for 'number of minutes' it was, date[[i, 6]] == 1 then date[[i, 6]] == 2 then date[[i, 6]] == 3 ...