# Google Sheet sumif based on month and year

I am learning Google Sheet and I am trying to create my own sheet to track expenses.

I have 1 drop down cell with date years (2022) and one cell with drop down with month (full name as in January)

I want to select the month and year and want to show all my expenses based on the selected year and month.

I have the month working, but I don't know how to integrate the year. What I know Is that my current code is using sumif, which only allows 1 criteria. So I should use "&" to add the year. ... but how?

={{ArrayFormula(sumif(ArrayFormula(text(Transacties!A2:A15;"MMMM")); unique(ArrayFormula(text(F2;"MMMM"))); Transacties!C2:C15))}}

• Welcome to Web Apps Stack Exchange! I don't fully understand your formula, but this seems like a job for SUMIFS Commented Jul 15, 2022 at 2:48

Your formula repeats `arrayformula()` and is enclosed in two superfluous { array expressions }. It can be simplified to:
`=arrayformula( sumif( text(Transacties!A2:A15, "MMMM"), text(F2, "MMMM"), Transacties!C2:C15 ) )`
To match both year and month, use `filter()`, like this:
`=sum( filter( Transacties!C2:C, text(Transacties!A2:A, "yyyyMMMM") = F2 & G2 ) )`