Search code examples
dategoogle-sheetsspreadsheetsumifsgoogle-query-language

How to SUMIF cells dated between two dates in spreadsheets


I have a SUMIF formula that works until I try to make it a criteria in a SUMIF function to only include the dates that are in the month of january. My formula looks like this so far:

=SUMIFS('Ingresos y egresos'!G3:G15,'Ingresos y egresos'!E3:E15,"Ingreso",'Ingresos y egresos'!F3:F15,"Diseño",'Ingresos y egresos'!D3:D15,">"&DATE(2022,1,1)OR<="&DATE(2022,1,31)")

Basically everything up until I begin touching the DATE stuff works. The idea is for it to SUMIF (using D3:D15 as the field that contains the dates) only when the date is between (and including) the 1st of january and the 31st of january. Which means pretty much only SUMIF if the date is in the month of January.

I am, however, unable to find answers online as to how to achieve this.

This is the working formula so far WITHOUT anything related to the date, in case the formula above is confusing.

=SUMIFS('Ingresos y egresos'!G3:G15,'Ingresos y egresos'!E3:E15,"Ingreso",'Ingresos y egresos'!F3:F15,"Diseño")

The dates will be found in 'Ingresos y egresos'!D3:D15


Solution

  • try this and drag to the right:

    =INDEX(SUM(IFNA(FILTER('Ingresos y egresos'!$G$3:$G, 
     'Ingresos y egresos'!$E$3:$E="Ingreso", 
     'Ingresos y egresos'!$F$3:$F=$D3, 
     MONTH('Ingresos y egresos'!$D$3:$D)=COLUMN(A1), 
     YEAR('Ingresos y egresos'!$D$3:$D)=2022))))
    

    enter image description here