Leo
Leo

Reputation: 553

Excel, Adding Specific Columns for Multiple Rows

If I have a table something like this:

  |A|B|C|D|
1 |1|0|1|
2 |4|4|2|
3 |7|2|3|
4 |5|7|2|
5 |3|9|1|

Is it possible to add up column A with column C, and display the result in D "=SUM(A1,C3)" BUT I would like to automate this for about 50 rows, so that:

D1=SUM(A1,C3), D2=SUM(A2,C2), D3=SUM(A3,C3)...D50=SUM(A50,C50)

Thanks!

Upvotes: 0

Views: 1064

Answers (1)

chris neilsen
chris neilsen

Reputation: 53135

If by BUT I would like to automate this you meann VBA, then try this

Sub Demo()
    Dim rng As Range
    ' Set rng to the required range, by whatever means needed
    Set rng = [D1:D50]
    ' Set Formulas of the range
    rng.FormulaR1C1 = "=SUM(RC[-3],RC[-1])"
End Sub

Upvotes: 1

Related Questions