Array formula to sum data that meets multiple criteria.

thegoldcoast

New Member
Joined
Oct 31, 2017
Messages
2
Hi, Everyone

I am having trouble finding the best formula to calculate how much i spent on a particular item per year. The issue that I am having is when my monthly payment spreads across multiple years, I can't seem to create a working formula that can account for the cost that spreads into the next year. I have tried using different array formulas but no luck. Would using VBA work better?

Here is an example of what I tired.


Logic:
{SUM(IF(AND[Item=Item , Date>=1/1/14 , Date<=12/1/14]), (Date - 12/1/14)*Monthly Payment,))}

Formula:
SUM ( IF( AND(B2=A9:A14, B9:B14>=1/1/14,B9:B14<=12//1/14), B9:B14-12/1/14)*D9:D14)


Category
2014
2015
2016
Bike
Mattress
Table
Stove
Purchases
ItemDate of PurchaseMonths to pay offMonthly PaymentTotal Cost.
Bike
8/14/14
6
300
1800
Mattress
10/6/14
8
2000
16000
Table
3/1/15
12
700
8400
Bike
8/1/15
6
400
2400
Stove
11/1/15
5
200
1000
Table
3/1/16
12
900
10800

<tbody>
</tbody>
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
maybe something like...

Unknown
ABCDE
1Category201420152016
2Bike3004000
3Mattress200000
4Table0700900
5Stove02000
6
7Purchases
8ItemDate of PurchaseMonths to pay offMonthly PaymentTotal Cost.
9Bike8/14/201463001800
10Mattress10/6/20148200016000
11Table3/1/2015127008400
12Bike8/1/201564002400
13Stove11/1/201552001000
14Table3/1/201612900108

<tbody>
</tbody>
Sheet1

Array Formulas
CellFormula
C2{=SUM(IF($B2=$A$9:$A$14,IF(YEAR($B$9:$B$14)=C$1,$D$9:$D$14)))}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0
Thank you Weazel for your reply, but for C2 it should be 1,200 because I am trying to figure out the total monthly payments I made for the year.

Your formula was helpful, I rearranged it a bit now I would like to add the multiple by D:D. How would I add that to this formula?

{=(SUM(IF($B2=$A$9:$A$14,IF(YEAR($B$9:$B$14)=C$1,(MONTH($B$9:$B$14)-12/1/2014,$D$9:$D$14))))}

Can I do something like that?

(12/1/14-8/1/14)*300=1200
 
Upvote 0

Forum statistics

Threads
1,214,870
Messages
6,122,019
Members
449,060
Latest member
LinusJE

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