Posts by soberguy

    General Layout of Problem: We get a large file of data (in excess of 150K rows, 35 columns) that needs to be split out into ~40 individual files. This isn't really a problem, as I can set those recordsets and transfer to individual files just fine. But those new files need to include a summary - by month - of the data.


    How would one go about summing the recordset?


    To complicate matters further, I need to sum by two separate criteria (WHERE FIELD=''Yes' - and FIELD!=''Yes') - and I have to do those sums by a varying number of criteria for each recordset. At minimum, I'd have 6 SUM queries for each month, representing up to 72 SUM queries for the end of the year file. At maximum, I'd have 30 SUM queries for each month, representing up to 360 SUM queries for the end of the year file.


    I can set up those queries no problem, I'm just curious if there's a better way than to establish a brand new recordset for each SELECT SUM query.


    I'm already creating the recordset to move the data to a new file. Can I simply sum the recordset I've already created? If so, what's the best way to do that? And yes, I'm open to worksheet formulas or any other solution that one can think of.

    Re: Sumproduct with multiple criteria


    And as soon as I posted here, there was a solution at the other site:


    I had posted:
    =SUMPRODUCT((--(A2:A31=F8))+(--(A2:A31=F9))+(--(A2:A31=F10)),C2:C31)



    Solution is:
    Here's another way to write that:


    =SUMPRODUCT(SUMIF(A2:A31,F8:F10,C2:C31))

    Trying to sum payment data based on two criteria: A doc ID and a Job Number. Trouble is I where I want the formula is essentially a "roll up" row for individual data sets, meaning I can have multiple Doc IDs and Job Numbers. Sample Data:
    [TABLE="class: grid, width: 260"]

    [tr]


    [td]

    DO

    [/td]


    [td]

    Job Number

    [/td]


    [td]

    Amount

    [/td]


    [/tr]


    [tr]


    [td]

    14014555

    [/td]


    [td]

    H117GG10

    [/td]


    [td]

    75000

    [/td]


    [/tr]


    [tr]


    [td]

    14012563

    [/td]


    [td]

    H1211L30

    [/td]


    [td]

    5000

    [/td]


    [/tr]


    [tr]


    [td]

    14012563

    [/td]


    [td]

    H1211L30

    [/td]


    [td]

    5000

    [/td]


    [/tr]


    [tr]


    [td]

    14012563

    [/td]


    [td]

    H1211L30

    [/td]


    [td]

    5000

    [/td]


    [/tr]


    [tr]


    [td]

    14014288

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    905

    [/td]


    [/tr]


    [tr]


    [td]

    14014286

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    3250

    [/td]


    [/tr]


    [tr]


    [td]

    14014289

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    2845

    [/td]


    [/tr]


    [tr]


    [td]

    14014288

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    700

    [/td]


    [/tr]


    [tr]


    [td]

    14014286

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    6310

    [/td]


    [/tr]


    [tr]


    [td]

    14014289

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    3240

    [/td]


    [/tr]


    [tr]


    [td]

    14014288

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    835

    [/td]


    [/tr]


    [tr]


    [td]

    14014289

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    2375

    [/td]


    [/tr]


    [tr]


    [td]

    14014286

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    4495

    [/td]


    [/tr]


    [tr]


    [td]

    14014289

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    3375

    [/td]


    [/tr]


    [tr]


    [td]

    14014286

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    5055

    [/td]


    [/tr]


    [tr]


    [td]

    14014288

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    680

    [/td]


    [/tr]


    [tr]


    [td]

    14014289

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    2450

    [/td]


    [/tr]


    [tr]


    [td]

    14014288

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    810

    [/td]


    [/tr]


    [tr]


    [td]

    14014286

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    4085

    [/td]


    [/tr]


    [tr]


    [td]

    14014288

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    875

    [/td]


    [/tr]


    [tr]


    [td]

    14014289

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    2735

    [/td]


    [/tr]


    [tr]


    [td]

    14014286

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    5110

    [/td]


    [/tr]


    [tr]


    [td]

    14014288

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    405

    [/td]


    [/tr]


    [tr]


    [td]

    14014286

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    5220

    [/td]


    [/tr]


    [tr]


    [td]

    14014288

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    490

    [/td]


    [/tr]


    [tr]


    [td]

    14014286

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    4215

    [/td]


    [/tr]


    [tr]


    [td]

    14014289

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    2740

    [/td]


    [/tr]


    [tr]


    [td]

    14014289

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    3165

    [/td]


    [/tr]


    [tr]


    [td]

    14014288

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    1225

    [/td]


    [/tr]


    [tr]


    [td]

    14014286

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    4895

    [/td]


    [/tr]


    [/TABLE]



    Roll Up Examples:
    [TABLE="class: grid, width: 453"]

    [tr]


    [td]

    Ref Doc ID

    [/td]


    [td]

    Job Number

    [/td]


    [td]

    Invoices Paid

    [/td]


    [/tr]


    [tr]


    [td]

    See Detail

    [/td]


    [td]

    See Detail

    [/td]


    [td]

    1 (formula to go here)

    [/td]


    [/tr]


    [tr]


    [td]

    NA

    [/td]


    [td]

    H1211800

    [/td]


    [td]

    0

    [/td]


    [/tr]


    [tr]


    [td]

    14014555

    [/td]


    [td]

    H117GG10

    [/td]


    [td]

    75000

    [/td]


    [/tr]


    [tr]


    [td]

    14012563

    [/td]


    [td]

    H1211L30

    [/td]


    [td]

    15000

    [/td]


    [/tr]


    [tr]


    [td][/td]


    [td][/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    See Detail

    [/td]


    [td]

    See Detail

    [/td]


    [td]

    2 (formula to go here)

    [/td]


    [/tr]


    [tr]


    [td]

    14014286

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    42635

    [/td]


    [/tr]


    [tr]


    [td]

    14014289

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    22925

    [/td]


    [/tr]


    [tr]


    [td]

    14014288

    [/td]


    [td]

    H1177SLZ

    [/td]


    [td]

    6925

    [/td]


    [/tr]


    [/TABLE]


    Ideally, I can have a simple formula with =IF(A2="See Detail",Sumproduct(This is where I need help),Sumproduct(--(Payments!DO=A2),--(Payments!JobNum=B2),Payments!Amount))


    For the TRUE portion of the IF, I can set the dynamic range to be A3:A5 without issue. I just can't figure out how to make SUMIFS or SUMPRODUCT work with Payments!DO=A3:A5. It always wants to sum A3:A5, and I'm not sure how to tell it those are separate values.


    Yes, it's all a bit convoluted, but the spreadsheet design is one I'm forced to use without changes, and the data sets are large enough that a one size fits all solution would be much better for me.


    Cross posted here: http://www.excelforum.com/exce…g-to-nest-sumproduct.html

    Re: Auto Populate troubles


    You're storing the invoice number on the CO2 Log (Column C) as text, instead of a number. You can't match a number to a text string, unless you convert the number to a text string, and subsequently match text to text.


    Change C to numbers instead of text.

    Re: Trouble Looping through list to generate individual worksheets


    It isn't the prettiest. A few notes: Change your save path, and set up your save name. Formulas will still refer back to your master sheet, so I'd probably change that, either by a pastespecial for values, or by populating the sheet with static data (it isn't too hard to fill the copy data with .offset(0,1)). Should get you going in the right direction though.