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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,215,968
Messages
6,127,983
Members
449,414
Latest member
sameri

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