need a suggestion please

Copper Contributor

I am trying to add up the numbers in the cells of column j, based on the year designated in column k. I'm not sure what formula will do that. I've looked at IF statements, VLOOKUP and XLOOKUP. They return a specific piece of data. I want to sum the numbers in one column, that all have a match in the second column. This is a sample of the data:

               293.042019
               447.362019
         18,341.402019
               313.202019
                        -  2019
               313.202019
               268.412019
         52,205.762020
               626.292020
                        -  2020
               447.352020
           1,342.082020
               671.042020

 

So I want my results to say

2019 = $19,976.61

2020 = $55,292.52

 

what formula can I use to do this? Thanks!

4 Replies

@lstanderfer 

Use SUMIF() or a pivot table.

 

ok, I'll try that. thank you!

@lstanderfer 

If you have Excel 365

= LET(
    distinctYears, UNIQUE(year),
    annualTotals,  SUMIFS(amount, year, distinctYears),
    HSTACK(distinctYears, annualTotals)
  )

would return the result you specify.

image.png

@PeterBartholomew1 

thank you!