Home > Software engineering >  How to get result from 1 category into a cell
How to get result from 1 category into a cell

Time:06-02

enter image description here

I have a Google Sheets. I need help with something I haven't figure out how to start with. Every time that a category appears in column A (House), the points, that are in column E (Points) in the same row have to be added to the result section in columns J, K.

For example, using the image attached, House Black has two people and in total there are 100 points. That result should appear in the result section in columns J,K.

As extra information, just in case is relevant, information is fed to this tab, by a form that is located in another tab in the same Google sheet.

Thanks for the help.

CodePudding user response:

You can use the SUMIFS function to add up the information when a speciic criteria is met

=SUMIFS(E:E,A:A,J3)    

Adding the above code into K3 will sum up column E (Points), where Column A (House), is equal to the value in cell J3 (Black)

CodePudding user response:

If you want all four totals in one go, make sure K3:K6 is empty and then place the following formula in K3:

=ArrayFormula(IFERROR(VLOOKUP(J3:J6,QUERY({A2:E},"Select Col1, SUM(Col5) GROUP BY Col1"),2,FALSE),0))

Another option is to delete J3:K6 and place the following in J3:

=QUERY({A2:E},"Select Col1, SUM(Col5) WHERE Col1 Is Not Null GROUP BY Col1 LABEL SUM(Col5) ''")

This will return the names in alphabetical order and all scores. Then you could just make sure your color blocks (background colors) in I3:K6 match the new order.

  • Related