Forum Discussion

Jreggy's avatar
Jreggy
Copper Contributor
Feb 27, 2019
Solved

finding the year in a range of cells

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

 

Jeff

4 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    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.

    • Jreggy's avatar
      Jreggy
      Copper Contributor

      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

      Regards

       

      Jeff

Resources