+ Reply to Thread
Results 1 to 9 of 9

Sumproduct Workaround

  1. #1
    Registered User
    Join Date
    03-23-2014
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    10

    Sumproduct Workaround

    Hi,

    I'm trying to use Sumproduct to lookup up a unique value in a range of cells. The range is for updated costs with the first row containing the date, the second row containing the supplier and the first column containing the product. This is what I have so far:

    =SUMPRODUCT((a2:a10=PRODUCT)*(b1:g1<=DATE)*(b2:g2=SUPPLIER),b3:g10)

    I want the formula to find the most recent entry after DATE, however I've only been able to sum the and entries previous to DATE. Is there a way to add another criteria to only sum/lookup the most recent entry?

    Thanks

  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: Sumproduct Workaround

    Hi and welcome to the forum

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    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
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699

    Re: Sumproduct Workaround

    Assuming that dates don't repeat try this "array formula"

    =SUM((B1:G1=MAX((B1:G1<=DATE)*(B2:G2=SUPPLIER)))*(A2:A10=PRODUCT)*B3:G10)

    confirmed with CTRL+SHIFT+ENTER
    Audere est facere

  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: Sumproduct Workaround

    DDL, can you explain how that works please?

  5. #5
    Registered User
    Join Date
    03-23-2014
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Sumproduct Workaround

    Hi,

    Thanks for the welcome. I've made up a mockup with my formula highlighted in yellow and the desired result/prices next to it.


    Most Recent Price Before Date.xlsx

  6. #6
    Registered User
    Join Date
    03-23-2014
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Sumproduct Workaround

    Quote Originally Posted by daddylonglegs View Post
    Assuming that dates don't repeat try this "array formula"

    =SUM((B1:G1=MAX((B1:G1<=DATE)*(B2:G2=SUPPLIER)))*(A2:A10=PRODUCT)*B3:G10)

    confirmed with CTRL+SHIFT+ENTER
    Hi,

    I've tried that out it doesn't seem to work for me. I'll double check that it's not an issue with my entries.

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699

    Re: Sumproduct Workaround

    Quote Originally Posted by FDibbins View Post
    DDL, can you explain how that works please?
    It doesn't

    I made an error with that version.....and as per example sreadsheet if dates can be repeated it needs an update anyway - for sample data try this formula in D10

    =SUM((B$1:G$1=MAX((B$1:G$1<=B10)*(B$2:G$2=C10)*B$1:G$1))*(A$3:A$7=A10)*(B$2:G$2=C10)*B$3:G$7)

    confirmed with CTRL+SHIFT+ENTER and copied down

  8. #8
    Registered User
    Join Date
    03-23-2014
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Sumproduct Workaround

    That's great, thanks a million. Was stuck on it all day.

  9. #9
    Registered User
    Join Date
    03-23-2014
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Sumproduct Workaround

    Hi DDL,

    Sorry for bringing this up again, but I'm having a small issue with this again. Whilst the formula works perfectly, it has become CPU intensive as the formula is used in 15,000 cells. Is there anyway to make it more CPU friendly?

    Thanks again

+ 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. [SOLVED] AutoFill | Workaround
    By AlaaAlii in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-06-2012, 10:24 AM
  2. SumProduct Index workaround
    By arazoe in forum Excel General
    Replies: 2
    Last Post: 09-20-2010, 10:10 AM
  3. #N/A Workaround
    By mcantrell in forum Excel General
    Replies: 5
    Last Post: 08-17-2010, 02:35 AM
  4. [SOLVED] Workaround for com exe timer?? help
    By Nicole Seibert in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-15-2006, 02:25 PM
  5. csv load 64K workaround
    By r0dr1g0 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-07-2005, 04:10 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