Year from range of cells

sharshra

Active Member
Joined
Mar 20, 2013
Messages
391
Office Version
  1. 365
I have a range of date cells. I have to sum up the return from these cells for each year. Sample table is given below.

Table 1
Book1
BCDE
2Sl.#Month Return Year
31Nov-221002022
42Dec-221012022
53Jan-232982023
64Feb-233572023
75Mar-234672023
86Apr-235092023
97May-239432023
Sheet1
Cell Formulas
RangeFormula
B4:B9B4=B3+1
C4:C9C4=EDATE(C3,1)
E3:E9E3=YEAR(C3)


I have to use SUMIF function & NOT a pivot table for various reasons. I'm using additional column in table 1 to find the year & then using it in table 2 to find the total for each year. Table below has the details.

I would like to eliminate the additional step to calculate the year in table 1. I'm sure there must be a better way to do this by deriving the year directly in SUMIF function in table 2. Can the experts in this forum throw some light on this?

Table 2
Book1
BC
2YearReturn
32022201
420232574
Sheet2
Cell Formulas
RangeFormula
C3:C4C3=SUMIF(Sheet1!$E$3:$E$9,B3,Sheet1!$D$3:$D$9)
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
How about
Excel Formula:
=SUM(FILTER(Sheet1!$D$3:$D$1000,YEAR(Sheet1!$C$3:$C$1000)=B3))
 
Upvote 0
Thanks, Fluff. I see that Filter & other array functions are available from O365 onwards. I have to use MS Office 2019 for some reason, which doesn't support array functions.

How can we achieve the same result in Office 2019 without using array functions?
 
Upvote 0
How about
Excel Formula:
=SUMIFS(Sheet1!D:D,Sheet1!C:C,">="&DATE(B3,1,1),Sheet1!C:C,"<="&DATE(B3,12,31))
 
Upvote 0
Solution
Make sure that your dates & numbers are real dates & numbers rather than text.
 
Upvote 0
Dates & numbers are correct. It's not text. But, the formula is returning 0.

Note that I have both tables in the same excel worksheet. Hence, you don't see the prefix 'Sheet1!...' in the formula.

Table 1
sumif.xlsx
BCDE
2Sl.#Month Amount Year
31Nov-221002022
42Dec-221012022
53Jan-232982023
64Feb-233572023
75Mar-234672023
86Apr-235092023
97May-239432023
Sheet1
Cell Formulas
RangeFormula
C4:C9C4=EDATE(C3,1)
E3:E9E3=YEAR(C3)


Table 2
sumif.xlsx
GH
8YearAmount
920220
Sheet1
Cell Formulas
RangeFormula
H9H9=SUMIFS(D:D,C:C,">="&DATE(B3,1,1),C:C,"<="&DATE(B3,12,31))
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top