Example data:
I want to sum everything in column B if its year in column A is 2023. I don't want to add a year column in column C. Instead, I'd like to write a SUMIFS
that somehow examines the year dynamically, within the formula itself. Is this possible?
I will note that =sumifs(B:B,YEAR(A:A),2023)
did not work, unsurprisingly.
It would be better to use SUM() or SUMPRODUCT() based on ones Excels Version.
• Formula used in cell D2
=SUM((YEAR(A2:A3)=2023)*B2:B3)
Also it is highly suggested to use Structured References
when you are not sure about the last row of your data, since taking the whole blank ranges will reasonably slow down the Excel functionality, since it will iterate through the blank/empty cells as well.