Need macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

For each row i in col G I'd like to place (the sum of the values in col F
from rows 1 to i) divided by i. Can someone show me how to do that?
 
You don't really need a macro for this:

G2: =sum(F$2:F2)/count(F$2:F2)

And copy the value down as needed.
 
One way:

Dim i As Long
i = Range("F" & Rows.Count).End(xlUp).Row
With Range("G1").Resize(i, 1)
.Formula = "=F1/" & i
.Value = .Value
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top