Google-sheets – Sum all expenses of a given type given a list of expense types in a separate sheet

google sheetsgoogle-apps-scriptworksheet-function

I use Google Sheets to keep track of my expenses. The file currently consists of:

  • Sheet 1: "Expense Types"
  • Sheet 2: "2015 Details".

The first column of Sheet 1 contains the list of admissible expense types, and each row in Sheet 2 details one single expense: data, notes, type and amount.

I would like to create a new Sheet 3: "2015 Summary" that would contain, on each row, a single expense type and the sum of all expenses of the given type. Moreover, I want this sheet to automatically update in case I add a new expense type on Sheet 1.

Is it possible to do this using worksheet formulas or do I need to do some scripting?

Best Answer

You can use a pivot table to do that. Choose Data > Pivot from the menus, and follow the prompts to set it up.

There's an example of something similar here: https://docs.google.com/spreadsheets/d/1VIeA4zAjID0y1jo1FnsbfGA4qmpRgAxMykLXi1pOfhc/edit?usp=sharing