finding the year in a range of cells

New Contributor

Hello everybody,


I'm trying to find a way that I can work out the year for every cell in a column, without having to individually type "YEAR (a1), Year (a2)….etc".  The column could hold 65000 cells eg. a1-a65000.

each cell in the range will have a different date and year. on each Row there is also a dollar value associated with that month and year. Just to make things harder, the dates on each row will not necessarily be in order.


I need to make a table that finds the year and the dollar value and the month. Each row in the table is for another year eg 2019, 2020, 2021 etc. and each column in the table is for the month. All dollar  values for that year, in that month needs to added together, to give a final total of sales for that month and year.


I am absolutely hopeless with VBA, and only just above a novice in excel use. Any help anyone could give me would be really helpful and appreciated



4 Replies

Hi Jeff,


Few variants

- you may pivot your source by year and month added in data model;

- you may use formula as SUMPRODUCT

- you may use Power Query

perhaps something else


Sample is attached.


Hello Sergei,


That is exactly what I am looking for. Thank you so much, I have been struggling with this for months, and in one night you showed me a nice simple way of doing this.


Thank you





Jeff, glad to help


Hi Sergei, 


I hate to be a pain, however it looks like I have transcribed the formula you gave me, incorrectly.

The problem is I have 3 sheets in the excel file which have the dates and cost on sheet 1 (Sales), sheet 2 (Payments) is only for when someone pays us, and sheet 3 (Yearly Figures) is where I am trying to keep a constant total of each month in a certain year.

This is the formula that I used: =SUMPRODUCT((YEAR('Sales '!A18:'Sales '!A18)=$C6)*(MONTH('Sales '!A18:'Sales '!A18)=D$5)*'Sales '!I18:'Sales '!I18)

I've included some snapshots of each page.


May I ask for your help once again


Best Regards



2019-02-28.png2019-02-28 (1).png2019-02-28 (2).png