Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to sum only the last row of a transposed query?

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

https://docs.google.com/spreadsheets/d/1ynIiMrR3RHtpeY86Nc7QKcBNQ_A-fxdm6R1kefek-bI/edit#gid=0

Thanks!

>Solution :

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))
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading