Sumproduct

Papi

Well-known Member
Joined
May 22, 2007
Messages
1,592
The workbook below needs to do a couple of things. I need it to count the number of items for a specific month based on one item per row i.e. the Quantity (No.) for Manifold base in August would be 2 and then the total cost for the same month. I'm not sure how to change the month as the list will continue on and each month I will have to identify the month and then collect the data by month i.e July would simply be 1 Boat Pin at $56.53 and 1 Anchor at $75.00 but August would have 2 Envelope Cases for a total of $10.56, 2 Manifold bases for a total of $130.60 and 1 Drill at $204.16 etc.

Monthly Parts List.xls
ABCD
1Jul1,2011No.Total
2Anchor
3Boat
4Cart
5Drill
6EnvelopeCase
7Manifoldbase
8
9DayPartDescriptionUnitCost
107/25/2011BoatPin56.53
117/31/2011Anchor75.00
128/5/2011EnvelopeCase5.28
138/8/2011ManifoldBase65.30
148/9/2011Drill204.16
158/12/2011ManifoldBase65.30
168/15/2011EnvelopeCase5.28
sheet2
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
The workbook below needs to do a couple of things. I need it to count the number of items for a specific month based on one item per row i.e. the Quantity (No.) for Manifold base in August would be 2 and then the total cost for the same month. I'm not sure how to change the month as the list will continue on and each month I will have to identify the month and then collect the data by month i.e July would simply be 1 Boat Pin at $56.53 and 1 Anchor at $75.00 but August would have 2 Envelope Cases for a total of $10.56, 2 Manifold bases for a total of $130.60 and 1 Drill at $204.16 etc.

Monthly Parts List.xls
ABCD
1Jul1,2011No.Total
2Anchor
3Boat
4Cart
5Drill
6EnvelopeCase
7Manifoldbase
8
9DayPartDescriptionUnitCost
107/25/2011BoatPin56.53
117/31/2011Anchor75.00
128/5/2011EnvelopeCase5.28
138/8/2011ManifoldBase65.30
148/9/2011Drill204.16
158/12/2011ManifoldBase65.30
168/15/2011EnvelopeCase5.28
sheet2
Define Lrow as referring to:

=MATCH(9.99999999999999E+307,Sheet2!$A:$A)

Define Dates as referring to:

=Sheet2!$A$10:INDEX(Sheet2!$A:$A,Lrow)

Parts as referring to:

=Sheet2!$B$10:INDEX(Sheet2!$B:$B,Lrow)

Costs as referring to:

=Sheet2!$D$10:INDEX(Sheet2!$D:$D,Lrow)

Assuming that B1 is a true date...

C2, just enter and copy down:

=SUMPRODUCT(--(Dates-DAY(Dates)+1=$B$1),--(Parts=$B2))

D2, just enter and copy down:

=SUMPRODUCT(Costs,--(Dates-DAY(Dates)+1=$B$1),--(Parts=$B2))
 
Upvote 0
Thanks very much Aladin. I will have to look at your data later on at work as I am not clear about what the first eight rows of information mean and what I am supposed to do with them. Hopefully it will make sense once my nose is to the grindstone.
 
Upvote 0
Thanks very much Aladin. I will have to look at your data later on at work as I am not clear about what the first eight rows of information mean and what I am supposed to do with them. Hopefully it will make sense once my nose is to the grindstone.

The ranges of interest the formulas have to refer to are defined as dynamic named ranges by the recipe given in those rows. This means that you don't have to adjust the ranges manually when they grow or shrink.
 
Upvote 0
Hello Aladin,

This is great! The only thing I have not figured into the mix is what the first item does and how?

"Define Lrow as referring to: =MATCH(9.99999999999999E+307,Sheet2!$A:$A)

Also, I put a macro in place to move the date ahead (or back) by one month at a time and it changes your numbers accordingly. One additional question - Is it possible to have the Date range filter to match the month in cell B1 by filtering A9 to match the same month?
 
Upvote 0
Hello Aladin,

This is great! The only thing I have not figured into the mix is what the first item does and how?

"Define Lrow as referring to: =MATCH(9.99999999999999E+307,Sheet2!$A:$A)

Lrow (from last row) determines at any moment the position of the last data record by looking at the numeric data in column A on Sheet2. This number is used in order to set up dynamic named ranges the SumProduct formulas refer to. This way you don't need to manually adjust the ranges whenever any change occurs in the data.

See for more:

http://www.mrexcel.com/forum/showthread.php?t=102091

http://www.mrexcel.com/forum/showthread.php?t=310278 (post #7)

Also, I put a macro in place to move the date ahead (or back) by one month at a time and it changes your numbers accordingly.

Good idea...

One additional question - Is it possible to have the Date range filter to match the month in cell B1 by filtering A9 to match the same month?

I would think that the summary calculations should suffice. If not, you can use perhaps another macro.
 
Upvote 0
Excellent. Thanks for all your help Aladin. I'll do some more reading. What you have done has this workbook performing at a whole new level. Again, thank you.
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,754
Members
452,940
Latest member
rootytrip

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