Excel VBA Array, add up columns where another column is the same value -
i have large table of 6 columns. have array of table created:
myarray = worksheets("sheet1").listobjects("table1").databodyrange.value i need add values in column 6 value in column 2 7.
i know easier in sql don't have access unfortunately (or access).
i have several different values in column 2 , need each group of distinct values.
use this:
function myfunc() integer myfunc = 0 = 1 999 if cells(i, 2).value = 7 myfunc = myfunc + cells(i, 7).value end if next end function change 999 number of rows you're iterating over, , sum value this:
dim sum integer sum = myfunc
Comments
Post a Comment