+ Reply to Thread
Results 1 to 6 of 6

convert SUMIF to SUMPRODUCT Formula

Hybrid View

  1. #1
    Registered User
    Join Date
    10-13-2019
    Location
    Brisbane, Australia
    MS-Off Ver
    Windows 10
    Posts
    3

    convert SUMIF to SUMPRODUCT Formula

    Its my first post here so hopefully you'll go easy one me

    Im trying to find a solution for my report.

    I have a basic SUMIF formula returning correct results, but the report I am working with is reporting monthly data. When I insert a column for the latest months data, with the SUMIF formula, all the relative references move along so that the current month column is excluded from all the formulas. I tried using $ in the formula but that didnt seem to fix it.

    To solve this I added in a SUMPRODUCT with VLOOKUP, hoping that with the VLOOKUP added, the index numbers would remain accurate even when a new column was added.

    However my SUMPRODUCT with VLOOKUP isnt working properly, when the lookup item appears twice or more in the data set, the formula only seems to be picking up the first entry and not summing all.

    There must be something really basic wrong with my formula. Hoping its an easy fix

    =(SUMPRODUCT(VLOOKUP(C5,'DETAIL DATA'!H:AH,{2,3,4},0)

    Or even just this to just get a single column (same result as SUMIF formula), will it work, or what is the fix?
    =(SUMPRODUCT(VLOOKUP(C5,'DETAIL DATA'!H:AH,{2},0)

    Ive attached an extract from my report, can go to SALES BY CUSTOMER sheet and cell E5
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: convert SUMIF to SUMPRODUCT Formula

    I started this by 1st putting the "current month" date in it's own cell (although, it looks you are testing last month (Sep) not this month (Oct)?)
    =EOMONTH(TODAY(),-2)+1
    Put this wherever you want, you can hide it too if needed. I used D1

    Then for the sum...
    D4=SUMIF('DETAIL DATA'!$H$6:$H$13,'SALES BY CUSTOMER'!C4,OFFSET('DETAIL DATA'!$H$6,0,MATCH('SALES BY CUSTOMER'!$D$1,'DETAIL DATA'!$H$1:$AI$1,0)-1,COUNTA('DETAIL DATA'!$H$6:$H$13),1))
    copied down
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    10-13-2019
    Location
    Brisbane, Australia
    MS-Off Ver
    Windows 10
    Posts
    3

    Re: convert SUMIF to SUMPRODUCT Formula

    Thankyou Ford! That works perfectly for the single month that I use your date formula for. What if I wanted to have to formula add up a few months eg, July, August and September, and put result in a single column (eg column E of my Sales By Customer sheet). This is what I was trying to do with the formula I posted above

    =(SUMPRODUCT(VLOOKUP(C5,'DETAIL DATA'!H:AH,{2,3,4},0)

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: convert SUMIF to SUMPRODUCT Formula

    This should work (for 12 months - see the 12 at the end)
    =SUMIF('DETAIL DATA'!$H$6:$H$13,'SALES BY CUSTOMER'!$C4,OFFSET('DETAIL DATA'!$H$6,0,MATCH('SALES BY CUSTOMER'!$D$1,'DETAIL DATA'!$H$1:$AI$1,0)-1,COUNTA('DETAIL DATA'!$H$6:$H$13),12))

    But for some reason it's not working properly, and its getting too late here (1:50 am) for me to think my way through this. If no1 else picks this up, I will take another look later today.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: convert SUMIF to SUMPRODUCT Formula

    THis should also work, but doesnt...
    =SUMIF('DETAIL DATA'!$H$6:$H$13,'SALES BY CUSTOMER'!$C4,INDEX('DETAIL DATA'!$I$6:$T$13,1,1):INDEX('DETAIL DATA'!$I$6:$T$13,8,12))

  6. #6
    Registered User
    Join Date
    10-13-2019
    Location
    Brisbane, Australia
    MS-Off Ver
    Windows 10
    Posts
    3

    Re: convert SUMIF to SUMPRODUCT Formula

    I appreciate your help thankyou!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. SUMPRODUCT or SUMIF Formula Help Please
    By reddaze in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-01-2017, 08:27 AM
  2. Sumproduct formula with sumif?
    By aqalna in forum Excel General
    Replies: 1
    Last Post: 10-05-2016, 06:49 PM
  3. SUMPRODUCT/SUMIF formula?
    By jasont1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-16-2014, 11:17 AM
  4. Sumproduct/sumif formula help please
    By simbalyon303 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 11-19-2012, 12:30 PM
  5. How can I convert this sumif statement into a Sumproduct?
    By ggremel in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-26-2010, 05:47 PM
  6. Sumproduct or sumif formula
    By vasto in forum Excel General
    Replies: 6
    Last Post: 08-24-2009, 03:06 PM
  7. [SOLVED] SumIf/SumProduct Formula Help
    By Jacinthe in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-10-2005, 07:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1