I am using this formula but it is summing everything within the range and I would like to sum only line J5 for example, this query needs to run on a list so every row will run this and sum only the 1 one row the function is located on.
=sum(transpose(query(Transpose($E$2:J5), " where Col1='A' ",1)))
You can see an example here:
https://docs.google.com/spreadsheets/d/1ynIiMrR3RHtpeY86Nc7QKcBNQ_A-fxdm6R1kefek-bI/edit#gid=0
Thanks!
CodePudding user response:
So you want to sum the values of a row but only when the header matches a value.
The approach with a transposed query could work if your initial table contains only the first row and the current row. You can build it with curly brackets {} like this:
=SUM(transpose(query(Transpose({E$2:J$2;E5:J5}), " where Col1='A' ",1)))
However, it would be easier to just do:
=SUMPRODUCT(IF(E$2:J$2="A",E5:J5,0))