I have the table below and i want it to read through columns A-B and then sum the values that match their names in columns C-D.
So that in a column elsewhere of a list of names i have the sum of their values from this table. For example Ed features in both columns with a value of 1 and 3, so would return a value of 4. Struggling to get this to work nicely. My actual table consists of 4 columns names and two sets of 4 columns with numbers.
A B C D
Steve Jeff 4 1
James Calum 1 1
Alex Andy 2 1
Peter Ed 0 3
Owen Harry 1 2
Jeff Steve 4 1
James Calum 1 1
Andy Alex 2 1
Peter Owen 0 3
Ed Harry 1 2
Answer
You can use SUMIF
, e.g.
=SUMIF(A:B,"ed",C:D)
replace "ed" with a cell value which contains your name, e.g.
With names in F2
down use this in G2
=SUMIF(A:B,F2,C:D)
SUMIF
works on a 1 to 1 basis so this only sums column C when column A matches and sums column D when B matches
You can also use where ranges are 4 columns wide
No comments:
Post a Comment