Problem with AVERAGEIF function in Excel Macros

JimmyOS

New Member
Joined
Feb 26, 2014
Messages
2
Hi,

I am a rookie at Macros!

I am using Excel 2013 on Windows 7.

I am currently trying to summarise average temperatures for each day of the year. I have downloaded the data from an onine BMS interface which gives the temperature every 15mins (up to 100 samples per day) so trying to find the daily average temperature will take quite a while manually.

I am trying to run a macro so that it will find the daily average temperature for me automatically.

My sheet is as follows.

Column A: Dates
Column B: Time sample was taken
Column C: Temperature


So what I have done is put each date 01/01/2011 - 31/12/2011 in Column E. I want to find the average for each date and put the value into the cell to the right of the date in column E.

I have been trying to write the macro myself but have had no luck so far. Here is my code:

Sub Test4()


Dim i As Integer
Dim j As Integer


j = 6


For i = 3 To 367


Worksheets(2).Cells(i, j).Value = _
"=AVERAGEIF(A3:A33186,Cells(i-1,j-1),C3:C33186)"

Next i


End Sub

It is returning DIV/0 error in the cells. Is this even possible to do?

Any help would be greatfully appreciated!! :confused::confused::confused:
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,223,099
Messages
6,170,109
Members
452,302
Latest member
TaMere

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top