View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default 2 dimensional loop, averageif formula

On Mar 23, 4:27*pm, Matthew Dyer wrote:
i'm struggling with the averageif formula. help?

[....]
For i = LastRw + 2 To LastRw + 4
* * For ii = LastCol - 37 To LastCol
* * Cells(i, ii).Formula = "=averageif(a1:a" & lastrw & ",b" &i&
",c1:c" &lastcol& ")"
* * Next ii
Next i


I find it helpful to write a prototype of the formula in Excel and
perhaps even test it in Excel first.

Also, when you ask a syntax question, it is essential that you copy-
and-paste from Excel or VBA into your posting. Apparently you did
not, since VBA does like &i& [sic]; that is, ampersand without
surrounding whitespace.

Or that the problem you want to solve? You never tell us what it is.

It also seems odd to me that the only thing that will change in your
AVERAGEIF is i. My guess is that you also want to "b" to vary with
ii.

Is that another part of the probem you want to solve? Again, you
never really explain what you want AVERAGEIF to look like in each
going across as well as down.