Sum values based on first occurrence of other column using excel formula -


let's have following 2 columns in excel spreadsheet

a   b 1   10 1   10 1   10 2   20 3   5 3   5 

and sum values b-column represents first occurrence of value in a-column using formula. expect following result:

result = b1+b4+b5 = 35 

i.e., sum column b unique value exists in same row column a. in case if ai = aj, bi=bj, i,j represents row positions. means if 2 rows a-column have same value, corresponding values b-column same. can have value sorted column values, prefer have formula works regardless of sorting.

i found post refers same problem, proposed solution not able understand.

use sumproduct , countif:

=sumproduct(b1:b6/countif(a1:a6,a1:a6)) 

enter image description here


to make dynamic, grows , shrinks data set use this:

=sumproduct($b$1:index(b:b,match(1e+99,b:b))/countif($a$1:index(a:a,match(1e+99,b:b)),$a$1:index(a:a,match(1e+99,b:b)))) 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -