Search code examples
google-sheetsgoogle-sheets-formulaspreadsheet

Need to turn a sumifs formula into an array


Can someone please help me to turn this formula:

=ROUND(if($B7="","",sumifs(Expenses!$B:$B,Expenses!$E:$E,$B7)))

into an array with this column title Total (12 months)?

Basically, it is searching through column E on the Expenses tab to find a match for cell B7 on the Budget Targets tab and return the value for that row from column B.

FYI - I already have this array formula in column D and it works just fine:

=IFNA(VSTACK("Monthly Average",ARRAYFORMULA(IF($E$7="",,$E$7:$E$11/12))))

See a sample workbook


Solution

  • You can also try this using ARRAYFORMULA

     =ARRAYFORMULA(VSTACK("Total (12 months)", IF(B7:B11<>"", ROUND(SUMIF(Expenses!$E:$E, B7:B, Expenses!$B:$B)), "")))
    

    Note: Copy and paste it into row E6

    Expected Output

    Categories Monthly Average Total (12 months) Percentage
    Armstrong Cable $0.92 $11.00 14%
    Eating Out $0.92 $11.00 14%
    CC $1.83 $22.00 29%
    CC $1.83 $22.00 29%
    Rent $0.92 $11.00 14%
    Total Expenses $6.42 $77.00 100%