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

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Heading = Before31/12/201801/01/2020
A1= Date
B1= Sym
C1= Numerical Value
Heading = After
E1= Date
F1= Sym
G1=Numerical Value
results for 2019
datesymvalue
30/11/2018red22red214
06/12/2018blue25blue226
12/12/2018green28green238
18/12/2018red31
24/12/2018blue34
30/12/2018green37
05/01/2019red40
11/01/2019blue43
17/01/2019green46
23/01/2019red49
29/01/2019blue52is this what you want
04/02/2019green55
10/02/2019red58
16/02/2019blue61
22/02/2019green64
28/02/2019red67
06/03/2019blue70
12/03/2019green73

<colgroup><col><col span="8"><col span="2"><col span="2"></colgroup><tbody>
</tbody>
 
Upvote 0
Maybe


Excel 2013/2016
ABCDEFGHI
1DateSymValueDateSymValueSum
201/01/1980AL1 1HB9601/01/1980AL1 1HB96192
301/12/2001AL1 1WB9601/12/2000AL1 1WB96
401/01/1980AL1 2NF9001/01/1980AL1 2NF90180
501/01/1980AL1 4HF10101/01/1981AL1 4HF101
601/01/1980AL1 5JW9401/01/1980AL1 5JW94188
701/12/1998AL10 0PY7801/12/1998AL10 0PY78156
801/02/2008AL10 1DJ8401/02/2008AL10 1DJ84168
901/01/1980AL10 8LG10201/01/1980AL10 8LG102204
1001/01/1993AL10 9NE8201/01/1993AL10 9NE82164
1101/01/1980AL2 1AU7301/01/1981AL2 1AU73
1201/02/2009AL2 2ES8701/02/2009AL2 2ES87174
1301/01/1980AL2 3PT7801/01/1980AL2 3PT78156
1401/01/1980AL3 4AT10801/01/1980AL3 4AT108216
1501/12/2001AL3 5LE11001/12/2001AL3 5LE110220
Data
Cell Formulas
RangeFormula
I2{=IFERROR(SUM(G2,INDEX($C$2:$C$15,MATCH(1,($B$2:$B$15=F2)*(YEAR($A$2:$A$15)=YEAR(E2)),0))),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Yes. I need to find all data within a given year and sum it for both headings independently. I also need to find all data within a given month and do the same thing. Just thought I would tackle one at a time.
 
Upvote 0
If I wanted to use that formula to do the same thing but look for data that matches a month name what would I change? I tried to change the YEARS value to MONTH but that didnt work. Do I need to change the 1 after match to the month name?
 
Upvote 0
If you only want to sum the values if Sym & month are the same, then use
=IFERROR(SUM(G2,INDEX($C$2:$C$15,MATCH(1,($B$2:$B$15=F2)*(MONTH($A$2:$A$15)=MONTH(E2)),0))),"")
Confirmed with CSE
 
Last edited:
Upvote 0
If you only want to sum the values if Sym & month are the same, then use
=IFERROR(SUM(G2,INDEX($C$2:$C$15,MATCH(1,($B$2:$B$15=F2)*(MONTH($A$2:$A$15)=MONTH(E2)),0))),"")
Confirmed with CSE

The sum cell goes blank when I change YEAR to MONTH even though the month and sym are the same
 
Upvote 0
Did you confirm it with Ctrl Shift Enter?
 
Upvote 0

Forum statistics

Threads
1,214,416
Messages
6,119,386
Members
448,891
Latest member
tpierce

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