+ Reply to Thread
Results 1 to 15 of 15

how to extend sumproduct formula beyond the current range

Hybrid View

  1. #1
    Registered User
    Join Date
    12-07-2016
    Location
    ALBANIA
    MS-Off Ver
    MICROSOFT OFFICE 2013
    Posts
    6

    how to extend sumproduct formula beyond the current range

    Hello All,

    I am using the sumproduct to sumif when the first number is 1 or 2. in column A I have the list of the accounts which are 7 digit number and in the column B, I have the amount. The formula is SUMPRODUCT(--(VALUE(LEFT(A4:A60,1))=1)+(VALUE(LEFT(A4:A60,1))=2),(B4:B60)). It works fine, but the issue is that I need to use the same formula for different range when pasting different set of data. When I try to extend the range of data and changing the formula in SUMPRODUCT(--(VALUE(LEFT(A4:A600,1))=1)+(VALUE(LEFT(A4:A600,1))=2),(B4:B600)), then I get #VALUE!. * I want the formula to work whenever I paste different set of data , like 20 or 200 rows in the column A and B.*

    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,908

    Re: how to extend sumproduct formula beyond the current range

    Try

    =SUMPRODUCT(((LEFT(A4:A600,1)="1")+(LEFT(A4:A600,1)="2")),(B4:B600))
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Registered User
    Join Date
    12-07-2016
    Location
    ALBANIA
    MS-Off Ver
    MICROSOFT OFFICE 2013
    Posts
    6

    Re: how to extend sumproduct formula beyond the current range

    it works at first, but when I delete rows from the end, the amount stays unchanged. However, when I delete cells or rows in the middle, the result is updated. Very strange!

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: how to extend sumproduct formula beyond the current range

    The formula doesn't like the blank cells. It falls over, giving a #VALUE error.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  5. #5
    Forum Contributor
    Join Date
    10-22-2022
    Location
    Santa Cruz, Bolivia
    MS-Off Ver
    MSO 365
    Posts
    157

    Re: how to extend sumproduct formula beyond the current range

    Hi there,

    Your formula has a problem when you try to extend the ranges, because the empthy espaces generate errors.

    I suggest this alternative solution:

    =SUMAPRODUCT(MMULT(--(LEFT(A4:A600)={"1"\"2"});{1;1});B4:B600)
    I hope was usefull.
    Last edited by ExceLogan; 10-22-2022 at 11:43 AM. Reason: Code error

  6. #6
    Registered User
    Join Date
    12-07-2016
    Location
    ALBANIA
    MS-Off Ver
    MICROSOFT OFFICE 2013
    Posts
    6

    Re: how to extend sumproduct formula beyond the current range

    Hi Logan, thanks but the formula does not work correctly. It is something related to brackets...

  7. #7
    Forum Contributor
    Join Date
    10-22-2022
    Location
    Santa Cruz, Bolivia
    MS-Off Ver
    MSO 365
    Posts
    157

    Re: how to extend sumproduct formula beyond the current range

    Hi again, maybe the problem was the argument separator ";", try change it all by ","

  8. #8
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.96 for Mac MS 365
    Posts
    8,693

    Re: how to extend sumproduct formula beyond the current range

    if I put data in past row 600 it returns results
    it is returning a value error because it is looking for data that isn't there.
    see in the example.
    Attached Files Attached Files
    Last edited by Sam Capricci; 10-22-2022 at 11:55 AM.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  9. #9
    Registered User
    Join Date
    12-07-2016
    Location
    ALBANIA
    MS-Off Ver
    MICROSOFT OFFICE 2013
    Posts
    6

    Re: how to extend sumproduct formula beyond the current range

    Yes you are right, but how do I make that it does not give #value. I do not want to change the formula anytime I change the data set

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: how to extend sumproduct formula beyond the current range

    One way round this is to cretae two Named Ranges (CTRL-F3 to edit):

    =$A$4:INDEX($A:$A,MATCH(10^100,$A:$A))

    and

    =$B$4:INDEX($B:$B,MATCH(10^100,$B:$B))

    called Acc and Amt. These adst to cover your exact range, automatically.

    Then use something like:
    =SUMPRODUCT((--((LEFT(Acc)+0=1)+(LEFT(Acc)+0)=2))*Amt)
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2019
    Posts
    4,542

    Re: how to extend sumproduct formula beyond the current range

    If the Account Codes all consist of 7 digits, why not just use SUMIFS: =SUMIFS(B4:B600,A4:A600,">=1000000",A4:A600,"<3000000").

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: how to extend sumproduct formula beyond the current range

    Did you look at Post 6??

  13. #13
    Registered User
    Join Date
    12-07-2016
    Location
    ALBANIA
    MS-Off Ver
    MICROSOFT OFFICE 2013
    Posts
    6

    Re: how to extend sumproduct formula beyond the current range

    hello, I checked and it worked. Thank you so much for your support1

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: how to extend sumproduct formula beyond the current range

    You're welcome.

  15. #15
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.96 for Mac MS 365
    Posts
    8,693

    Re: how to extend sumproduct formula beyond the current range

    well, I was going to mention that if you are not averse to using a helper column there is a simple formula and fix...
    in col C... =IF(A4="","",IF(OR(--LEFT(A4,1)=1,--LEFT(A4,1)=2),"yes",""))
    then this sumif =SUMIF(C:C,"yes",B:B)
    that covers the entire range regardless of the number of cells you have data in.

+ 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. Extend formula - for a range of columns
    By Wabisch in forum Excel General
    Replies: 2
    Last Post: 05-25-2020, 04:42 PM
  2. [SOLVED] Improved Formula / i've run out room to extend the current formula
    By pmw19800 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-29-2018, 01:58 PM
  3. [SOLVED] Improved Formula / i've run out room to extend the current formula / (avdanced code needed
    By pmw19800 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-29-2018, 06:19 AM
  4. Extend formula range dinamically while using an array ?
    By andreapenna in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-31-2017, 10:48 AM
  5. [SOLVED] Extend current formula for a date range
    By playaller in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2013, 06:26 PM
  6. Using SUMPRODUCT based on current date range
    By helyes in forum Excel General
    Replies: 9
    Last Post: 06-17-2011, 12:22 PM
  7. Extend Summation Range in SUMPRODUCT
    By jpeirano in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 03-13-2011, 12:41 PM

Tags for this Thread

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