SOLVED

How to calculate sum of one column based on a vlookup of another column's values?

Copper Contributor

Hi, I am trying to find a way to calculate the sum of values in column B based on the value of cells in column A, as in the attached file. So how many of each T-Shirt size are in columns A + B.

 

I have tried to use B20=SUMIF(A20:A24;(VLOOKUP(A20;A2:B16;2;FALSE);B2:B16)) but this throws an error.

 

Any suggestions will be welcomed!

2 Replies
best response confirmed by Colin59 (Copper Contributor)
Solution

@Colin59 

=SUMIF($A$2:$A$16,A20,$B$2:$B$16)

An alternative could be SUMPRODUCT. 

This works! Strange things happen when you have two excel files open and you copy from one to the other (cross-references the file that you copy from). 

 

Many thanks

1 best response

Accepted Solutions
best response confirmed by Colin59 (Copper Contributor)
Solution

@Colin59 

=SUMIF($A$2:$A$16,A20,$B$2:$B$16)

An alternative could be SUMPRODUCT. 

View solution in original post