I have 4 columns of codes, and another table that basically says that “group” the code falls into. Like so:
c1 c2 c3 c4
1 0 2 3
2 3 4 5
3 4 2 0
The second table is
code group
1 a
2 a
3 a
4 b
5 b
I want to add a column next to C4 that will sum or count all of the values that are part of Group a. I tried doing
{=sum(if(vlookup({1,0,2,3},code:group,2,false)="a",1,0))}
but it doesn’t work (the 1,0,2,3 is just to simulate selecting the first row of data from table 1).
Any ideas how I can do it?
Assuming you have two named ranges
CodeandGrouptry this array* formula in the first row and fill down:=SUM(--(IFERROR(LOOKUP(A1:D1,Code,Group)="a",0)))*Commit the formula by pressing
Ctrl+Shift+Enter