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
 
01/04/2018
28/03/20183
01/04/2018-9
05/04/20185sum of pos
09/04/2018-860
13/04/201822
17/04/2018-7
21/04/201833
25/04/2018-6
05/05/201844
A1 is entered as a nomal date
60 from
=SUMPRODUCT((RIGHT(TEXT($B$2:$B$10,"mmm"),4)=TEXT($A$1,"mmm"))*($C$2:$C$10))
it now sums for april
if you wanted april 17 and april 18 more work is needed

<tbody>
</tbody>

No thats perfect thank you! Now if I could get you to show me what you did in the beginning to include the symbol, that would be golden!
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
01/04/2018
28/03/20183
01/04/2018-9
05/04/20185sum of pos
09/04/2018-860
13/04/201822
17/04/2018-7
21/04/201833
25/04/2018-6
05/05/201844
A1 is entered as a nomal date
60 from
=SUMPRODUCT((RIGHT(TEXT($B$2:$B$10,"mmm"),4)=TEXT($A$1,"mmm"))*($C$2:$C$10))
it now sums for april
if you wanted april 17 and april 18 more work is needed

<tbody>
</tbody>

Can I get it to pull the month data within what we have already developed?

For example: We now have the ability to find all values within a given year +/- and sum them (thanks to you!) and it works perfect. I would like to expand on it if possible and use the same structure, which according to my understanding, I would need to create 12 additional helper cells for each month with your sumproduct formula in each month, i.e C2:N2 that references the helper cell for the months but looks to the year selected in A1 to pull the sums from the available range of values. Is that possible?

=Changeable Year=Helper ColumnJanFebMarAprMayJunJulAugSepOctNovDec
A1Sums by yearNeed a formula to allow me to sum all values for this month within the year selectedand this oneand this oneand this oneetcetcetcetcetcetcetcetc

<tbody>
</tbody>

According to my logic on what you have done I would need a different helper cell from B3:B15 as well that instead of referencing the year part of the date, it would look to the month part of the date. And, if its not to much to ask I need it to follow US date format with the month first.. Sorry ;0)
 
Last edited:
Upvote 0
Can I get it to pull the month data within what we have already developed?

For example: We now have the ability to find all values within a given year +/- and sum them (thanks to you!) and it works perfect. I would like to expand on it if possible and use the same structure, which according to my understanding, I would need to create 12 additional helper cells for each month with your sumproduct formula in each month, i.e C2:N2 that references the helper cell for the months but looks to the year selected in A1 to pull the sums from the available range of values. Is that possible?

=Changeable Year=Helper ColumnJanFebMarAprMayJunJulAugSepOctNovDec
A1Sums by yearNeed a formula to allow me to sum all values for this month within the year selectedand this oneand this oneand this oneetcetcetcetcetcetcetcetc

<tbody>
</tbody>

According to my logic on what you have done I would need a different helper cell from B3:B15 as well that instead of referencing the year part of the date, it would look to the month part of the date. And, if its not to much to ask I need it to follow US date format with the month first.. Sorry ;0)

Update: I took the formula to find the values in the range and applied it from Column Jan:Dec and changed the part of the formula from yyyy to mmm.
In the Helper Column I used the formula =("1/1"&A2) and changed it respectively, 1 for each month to =("2/1"&A2) etc...



It did find all the values for each month but unfortunately It wont limit to the year I selected in the drop down....

I also tried to edit the formula. Instead of just "mmm" I put "mmm-yyyy" and that didnt work either....

Thoughts?
 
Last edited:
Upvote 0
2018plusminus
23/09/20174
24/10/20175
24/11/2017-20
25/12/20176
25/01/20187plusminus
25/02/2018-21jan70
28/03/20188feb0-21
28/04/20189mar80
29/05/201810apr90
29/06/2018-22may100
30/07/201811jun0-22
30/08/2018-23jul110
30/09/201812aug0-23
31/10/201813sep120
01/12/201814oct130
01/01/201915nov00
01/02/2019-24dec140
04/03/201916
04/04/2019-25
the 7 for jan plus obtained by
=SUMPRODUCT((RIGHT(TEXT($B$2:$B$20,"yyyy"),4)=$A$1)*($C$2:$C$20)*(TEXT($B$2:$B$20,"mmm")=G7))
the 2018 in cell A1 is entered as text

<colgroup><col><col><col span="11"></colgroup><tbody>
</tbody>
 
Upvote 0
2018plusminus
23/09/20174
24/10/20175
24/11/2017-20
25/12/20176
25/01/20187plusminus
25/02/2018-21jan70
28/03/20188feb0-21
28/04/20189mar80
29/05/201810apr90
29/06/2018-22may100
30/07/201811jun0-22
30/08/2018-23jul110
30/09/201812aug0-23
31/10/201813sep120
01/12/201814oct130
01/01/201915nov00
01/02/2019-24dec140
04/03/201916
04/04/2019-25
the 7 for jan plus obtained by
=SUMPRODUCT((RIGHT(TEXT($B$2:$B$20,"yyyy"),4)=$A$1)*($C$2:$C$20)*(TEXT($B$2:$B$20,"mmm")=G7))
the 2018 in cell A1 is entered as text

<tbody>
</tbody>

I get Zero

excelfomulascreenshot.jpg
 
Upvote 0
in row 29 you should see my formula, so put a " ' " ie a quote character in front of the first equals sign then repost
 
Upvote 0
in row 29 you should see my formula, so put a " ' " ie a quote character in front of the first equals sign then repost

The formula is at the top of the image I posted last. Its the formula bar from excel.

I'll just repost. Didnt know you could comment out the formula like that. One of things I love about this site. You can learn so much from other people.

excelfomulascreenshot.jpg
 
Last edited:
Upvote 0
the formula is correct it should be in H7 and return 7

Do I need to use CTRL SHIFT ENTER on the formula?

Reason I ask is if I copy your cells I can reproduce it, even across multiple sheets with a validation list.

If I just reproduce it manually w/out a validation list, it wont compute.

I have checked the formatting of the cells to match and that doesnt seem to matter.

If not, do you have any ideas what I may be missing?
 
Upvote 0

Forum statistics

Threads
1,215,521
Messages
6,125,308
Members
449,218
Latest member
Excel Master

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