I'm making a financial analysis model for real estate properties. I created a named function called INCOME
that calculates total income for a given property name from a database of different income types for each property, e.g. rent, late fees, misc. income, etc.
For example, if you type in =INCOME("Property A")
, it will calculate the total income for Property A from the database.
Now I'm trying to calculate Income (along with a lot of other more complicated functions) across the entire portfolio of properties.
So I want to make a list of all the properties, say Property A, Property B, and Property C, then I want to calculate the sum of the incomes using my INCOME
function. See snippet below:
But I want this to be dynamic. So what I really want is to enter a formula that says: take the sum of INCOME(B5)
to INCOME(Bn)
where Bn
is the last non-empty row, i.e. the last property in the Properties column. This way it will update correctly as I add more properties.
Is it possible to do this in Google Sheets (without using Apps Script)?
You may try this & see how it goes:
=let(Σ,tocol(B5:B,1),
reduce(,sequence(counta(Σ)),lambda(a,c,a+index(INCOME(Σ),c))))