Home > Back-end >  ArrayFormula Only Iterating The First Value Throughout the Column, Need All the Values that Fit the
ArrayFormula Only Iterating The First Value Throughout the Column, Need All the Values that Fit the

Time:12-07

The problem:

I have two sheets, Auto Expenses & Business Expenses (duplicate sheets with different categories of expenses) Column J represents the cost of an expenses Column F represents the date of the expense

I am trying to create a function that will add up all of the expenses between both sheets given a start date & an end date and iterate down the column

Here is the function I wrote:

=ArrayFormula(if(isblank(F2:F),"",SUMIFS('Auto Expenses'!$J$7:$J,'Auto Expenses'!$F$7:$F,">="&O2:O,'Auto Expenses'!$F$7:$F,"<="&P2:P) SUMIFS('Business Expenses'!$J$7:$J,'Business Expenses'!$F$7:$F,">="&O2:O,'Business Expenses'!$F$7:$F, "<="&P2:P)))

O2:O is a list of start dates & P2:P is a list of end dates>

When I run the function, it will only return the first sum of the expenses and iterate all the way down with the same value.

What am I doing wrong?

If I use this function instead and drag is down, it gives the proper results, but I want it to iterate down the column automatically

=SUMIFS('Auto Expenses'!$J$7:$J,'Auto Expenses'!$F$7:$F,">="&O2,'Auto Expenses'!$F$7:$F, "<="&P2) SUMIFS('Business Expenses'!$J$7:$J,'Business Expenses'!$F$7:$F,">="&O2,'Business Expenses'!$F$7:$F, "<="&P2)

Here is a link to a copy of the spreadsheet for reference: enter image description here

Then do the same thing for business expenses (which isn't yet populated in your sample sheet).

  • Related