Referencing two variables for a SUMPRODUCT

jardenp

Active Member
Joined
May 12, 2009
Messages
373
Office Version
  1. 2019
  2. 2016
  3. 2013
  4. 2011
  5. 2010
Platform
  1. Windows
I'm trying to figure out how to use SUMPRODUCT with one of the variables being within a range, not a direct match. I know how to do this when trying to match two variables, but the date range is tripping me up. I'm trying to figure out the formula that goes in C2 of Book1-Sheet1.

I have a list of Unit Numbers, Transaction Dates, and Amounts that is roughly 160,000 rows with about 400 unit nuumbers. My goal is to summarize the amounts for units in a given period of time from their in-service date. The periods are years out from the in-service date, with the years being individually accounted for. For example, if unit 9828 was in-service on 1/5/2005, then year one would be 1/5/2005 - 1/4/2006 and year 2 would be 1/5/2006 - 1/4/2007, etc.

Book1-Sheet1
UnitIn-Service Date12345
98281/5/2005

<tbody>
</tbody>
The values in C1:G1 are numbers and I was planning on using them in the formula. So the formulas would be:

C2 = sum of all transactions amounts in Book2-Sheet1 with (Unit = A2) and (TransDate is [>= (MM of B2)/(DD of B2)/(Year of B2 + (C1 - 1))] AND [< (MM of B2)/(DD of B2)/(Year of B2 + C1)]
D2 = sum of all transactions amounts in Book2-Sheet1 with (Unit = A2) and (TransDate is [>= (MM of B2)/(DD of B2)/(Year of B2 + (D1 - 1))] AND [< (MM of B2)/(DD of B2)/(Year of B2 + D1)]
etc.

So, the data set:

Book2-Sheet1
UnitTransDateAmount
98282/5/2005100
98283/5/2005100
98282/5/2006100
98282/5/2007100
98283/5/2007100
98284/5/2007100
98282/5/2008100
98282/5/2009500

<tbody>
</tbody>

Would yield:

Book1-Sheet1
UnitIn-Service Date12345
98281/5/2005200100300100500

<tbody>
</tbody>

I'm looking for the formula for C2 and I can figure the rest from there.

Thanks!

Josh in IN
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
OK. I think I found my problem: I was using too large of numbers for the lookup ranges. I wanted to leave my options open so I used, for example, D2:D1000000. I changed things to D2:200000 and it now works. Here I was thinking I needed a different approach to SUMPRODUCT.
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

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