Just to clarify a little more, all I have to do is find out if the Year at position[i] of windlog is equal to the year input by the user, for all the records of each month in that year I need to make calculations. If there is no existing month for that year, say there are no records for March, I just have to output 'No Data' for that month. If there are say 60 records for April, I need to calculate average temperature and standard deviation for all 60 records in the month of April and so on.