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

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -