Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simplified example of summing array

Status
Not open for further replies.

jluft

Technical User
May 4, 2004
74
US
Sub test()
Dim testarray(1, 2)
Dim fullarray(1)

fullarray(1) = Range("TestRange")

tester = Application.WorksheetFunction.Sum(fullarray(1))

tester2 = Application.WorksheetFunction.Sum(fullarray(1)(*, 2))

End Sub

"Test Range" is the following range

1 2
2 4
3 6
4 8
5 10
6 12

tester returns 64 (which is correct)

tester2 is the problem. I am trying to return the sum of all elements in the 2nd column (to arrive at 42)

is there any way to do this?
thanks
 


See my post in your original

Skip,

[glasses] [red]Be advised:[/red]To be safe on the FOURTH, don't take a FIFTH on the THIRD, or...
You might not come FORTH on the FIFTH! [bomb][tongue]
 
i posted to the original as well...is this not a possible operation at all? you can sum an entire array but not a portion of it?
 


Again, use Insert/Name/Create - Create name in TOP row, assuming that the table has ONE ROW of heading values.
[tt]
=SUM(Val1)+SUM(Val2)
=SUM(Val2)
[/tt]
spreadsheet!!!

Skip,

[glasses] [red]Be advised:[/red]To be safe on the FOURTH, don't take a FIFTH on the THIRD, or...
You might not come FORTH on the FIFTH! [bomb][tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top