putting in a sum finction

H

Hru48

Hey all,

Is there a way that I can put the formula of SUM(E:F) through the whole
of column G (result field) automatically.

eg so cell G1 would be SUM(E1:F1)
G2 would be SUM(G2:F2)

etc.

many thanks

Hayley
 
N

Niek Otten

Yes. In G1, enter =SUM(E1:F1) or simply =E1+F1
Double-click on the right-hand bottom square in cell G1. It will fill down
(and adjust) the formula as far as F is filled.
You can also manually "drag down" the formula as far as you wish.
 
B

Bernard Liengme

Excel automatically modifies cells; so if in G1 you have =SUM(E1:F1) and you
copy (by dragging it) this formula to G2 it will read =SUM(E2:F2) - I think
you have a typo in your question.

Further points:
1) You do not need SUM; for a simple formula like this I would use =E1+F1
2) If there is data in column F when you type in G1, you can double click
G1's fill handle (little solid square in lower right of selected cell) to
automatically copy the formula down
or
3) If you select, say G1:G100, type the formula and then press CTRL+ENTER
you will fill the entire range with the required formulas

best wishes
 
H

Hru48

Sorry, I wasn't quite clear enough. I'm looking for a wee bit of code I
can jst place in the middle of a macro to do this for automatically?

Cheers
 
B

Bernard Liengme

Any use:
Sub Macro1()
Range("G1").Select
ActiveCell.FormulaR1C1 = "=RC[-2]+RC[-1]"
Selection.AutoFill Destination:=Range("G1:G26")
End Sub
 
Top