Question

I have a google spreadsheet that looks like this, for budget keeping.

I want people to be able to put lines into the "expenditures" section on the right, and include one of the budget codes (blue highlight). For example, if someone spent $30 on "House Bugdet", they would put 30 in the amount column (yellow) and "HB" in the Budget code column (blue).

My idea is that I can use these budget codes to calculate how much of each budget has been spent in the red-highlighted column. e.g. HB should show that $30 has been spent, and HA should show that $20 has been spent, in the example below.

The spreadsheet

Here is the spent column (red) formula I've been working on for a while, but I feel like I don't fully understand SUMIF().

=SUMIF(H:H,B3=REFERENCE(NULL,ROW(),H,NULL),K:K)

I'm pretty inexperienced at spreadsheet formulae so any help would be very appreciated!

Was it helpful?

Solution

Turns out the answer was very simple and required careful reading of the docs.

The criterion can be a cell reference that it compares the range to, so:

=SUMIF(H:H,B3,K:K)

worked for me! (Where B3 changes depending on the row: C3, D3, etc.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top