Find value according to different criteria and sum

riskier4ra

Board Regular
Joined
Dec 5, 2017
Messages
101
Hey there, anyone know how I can do the following? My guess is I would use Index Match but not sure how to involve the date aspect.

I need to sum some values that match by a common symbol under two different headings, but only if they fall within the same calendar year.

So. If sym A matches sym B check date for year and if the same sum the value of C1 & G1. If year in After does not match the year found in Before do nothing. Do not want to use SUMIF, would prefer to use SUMPRODUCT

Heading = Before
A1= Date
B1= Sym
C1= Numerical Value

Heading = After
E1= Date
F1= Sym
G1=Numerical Value

Thanks for any help you all can give,
Risk
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
2018cell A1 has 2018 entered as text01/01/2018
01/04/20174cell M1 converts this to 1/1/1831/12/2018
07/06/20177cell M2 converts this to 31/12/18
13/08/2017-4
19/10/2017-5
25/12/20179sum of possum of neg
02/03/2018323-15
08/05/20188
14/07/2018-6
19/09/201812
25/11/2018-9
31/01/2019-55
08/04/201944
formula giving 23
=SUMPRODUCT(($B$2:$B$13>=$M$1)*($B$2:$B$13<=$M$2)*($C$2:$C$13))

<colgroup><col><col><col span="6"><col><col><col span="2"><col><col span="3"></colgroup><tbody>
</tbody>
 
Upvote 0
2018cell A1 has 2018 entered as text01/01/2018
01/04/20174cell M1 converts this to 1/1/1831/12/2018
07/06/20177cell M2 converts this to 31/12/18
13/08/2017-4
19/10/2017-5
25/12/20179sum of possum of neg
02/03/2018323-15
08/05/20188
14/07/2018-6
19/09/201812
25/11/2018-9
31/01/2019-55
08/04/201944
formula giving 23
=SUMPRODUCT(($B$2:$B$13>=$M$1)*($B$2:$B$13<=$M$2)*($C$2:$C$13))

<tbody>
</tbody>

Hi OldBrewer, Is it possible to use with index match so dates dont have to placed in M1&M2, and I can just change the value in A1 dynamically without having to build a date table? I guess what Im trying to do is sort of like what vlookup does but sum the values associated with the dates that it finds. This is definitely closer to what I'm looking for. Really appreciate the help!
 
Upvote 0
Also, the values are not coming out.
excelfomulascreenshot.jpg
 
Upvote 0
01/01/2018
01/03/20173
04/06/2017-9
07/09/20175sum of possum of neg
11/12/2017-855-13
16/03/201822
19/06/2018-7
22/09/201833
26/12/2018-6
31/03/201944
A1 is entered as a nomal date
55 from
=SUMPRODUCT((RIGHT(TEXT($B$2:$B$10,"yyyy"),4)=TEXT($A$1,"yyyy"))*($C$2:$C$10))
-13 from
=SUMPRODUCT((RIGHT(TEXT($B$2:$B$10,"yyyy"),4)=TEXT($A$1,"yyyy"))*($D$2:$D$10))

<colgroup><col span="2"><col span="11"></colgroup><tbody>
</tbody>
 
Upvote 0
01/01/2018
01/03/20173
04/06/2017-9
07/09/20175sum of possum of neg
11/12/2017-855-13
16/03/201822
19/06/2018-7
22/09/201833
26/12/2018-6
31/03/201944
A1 is entered as a nomal date
55 from
=SUMPRODUCT((RIGHT(TEXT($B$2:$B$10,"yyyy"),4)=TEXT($A$1,"yyyy"))*($C$2:$C$10))
-13 from
=SUMPRODUCT((RIGHT(TEXT($B$2:$B$10,"yyyy"),4)=TEXT($A$1,"yyyy"))*($D$2:$D$10))

<tbody>
</tbody>

That's awesome. Thank you! Any chance A1 can just be the year i.e 2018? I tried to change the format of it to yyyy but that didnt work.
 
Upvote 0
format A1 as yyyy - it will still be 1/1/2018 but display as 2018

otherwise use a hidden helper cell, maybe ?
 
Upvote 0
format A1 as yyyy - it will still be 1/1/2018 but display as 2018

otherwise use a hidden helper cell, maybe ?

Im using a data validation list to select a year.

Could I see the code difference for your earlier suggestion that included symbol?
 
Upvote 0

Forum statistics

Threads
1,214,991
Messages
6,122,628
Members
449,095
Latest member
bsb1122

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