Google-sheets – Sum a quantity list in an array

formulasgoogle sheetsgoogle-sheets-arrayformula

I have an array table using ARRAYFORMULA({Fruit Names, Quantity}) that looks like

| Apples  |  2 |
| Oranges |  3 |
| Bananas |  5 |
| Oranges | -2 |
| Bananas | -1 |
| Apples  |  1 |

I'd like to sum all the unique items into one list into:

| Apples  |  3 |
| Oranges |  1 |
| Bananas |  4 |

Without referencing specific cells (I populated the arrayformula from other data). Any way to do this without referencing cells and using only arrayformula?

Best Answer

Found the solution with

Query(ARRAYFORMULA, "select Col1, sum(Col2) where Col1<>'' group by Col1")