+ Reply to Thread
Results 1 to 9 of 9

Summing a row (Dynamic in length)

  1. #1
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Summing a row (Dynamic in length)

    Hello All, please can someone assist - using my attached example.

    On Sheet4 I have my P/N (part number) which can be selected from a dropdown list (Cell C6)
    I also have an end date (entered in cell C7)

    From this info I want a formula to calculate what I have manually entered in cell C2.

    Basically, C2 needs to look at sheet 1 (Nov) and find the part number in column B - and sum the total of the row until the specified end date (30/03/2016). So in this instance it sums Row 19 and 36 - from D:DV

    Is it possible to do this easily in a formula, bearing in mind the P/N may change and also the end date. The starting row to sum will always be D
    Attached Files Attached Files

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Summing a row (Dynamic in length)

    May be:

    =SUMPRODUCT((Items=Sheet4!$C$6)*(Nov!$D$1:$LJ$1<=Sheet4!$C$7)*Nov!$D$4:$LJ$84)
    Quang PT

  3. #3
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Re: Summing a row (Dynamic in length)

    Quote Originally Posted by bebo021999 View Post
    May be:

    =SUMPRODUCT((Items=Sheet4!$C$6)*(Nov!$D$1:$LJ$1<=Sheet4!$C$7)*Nov!$D$4:$LJ$84)
    Hi, this just produces #N/A

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Summing a row (Dynamic in length)

    Why not? It works for me.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Re: Summing a row (Dynamic in length)

    I tried pasting the formula into my "master" sheet - which is bigger file than I posted on here and it just returns N/A.

    Is there something in teh code that could be dependant on something? What does the "Items" part mean?

    TIA

  6. #6
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Summing a row (Dynamic in length)

    In sample file, hit Ctrl-F3 to see the formula of the name "Items", then apply it to your actual file.

  7. #7
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Re: Summing a row (Dynamic in length)

    Hi, this still does not work for me. I still get N/A

    I have made attachement of my master file to show the error
    Attached Files Attached Files

  8. #8
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Summing a row (Dynamic in length)

    Hi there,

    Take a look at the attached workbook and see if it does what you need.

    It uses a combination of "native" Excel functions and VBA functions because using the SUMPRODUCT function in VBA can sometimes be less than straightforward!

    The formula entered in the worksheet is as follows:

    Please Login or Register  to view this content.
    Where Cell B6 contains the name of the worksheet (month) for which the calculation is being performed, Cell C2 contains the relevant Part Number, and Cell C3 contains the latest date which should be taken into consideration.

    The "PartNos", "Dates" and "SubTotals" functions are defined in VBA as follows:

    Please Login or Register  to view this content.
    The highlighted values may be altered to suit your worksheet layout requirements.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files

  9. #9
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Summing a row (Dynamic in length)

    Nearly all of the P/Ns apprear multiple times in the column of P/Ns do you have another identification of the row to go along with the P/N so that the correct row can be identified?
    This will total the P/N for the first match of the P/N but with multiple entries for the P/N that isn't good enough.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by newdoverman; 01-22-2016 at 05:32 PM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

+ 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. Replies: 4
    Last Post: 08-21-2015, 03:44 PM
  2. [SOLVED] SumProduct of Unique values in a dynamic length column
    By ddander54 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-20-2013, 05:24 PM
  3. [SOLVED] Fixed-length dynamic array: rolling computation
    By marcobm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-17-2013, 01:15 PM
  4. Problems Auto Summing columns that are missing data
    By davidsky1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2012, 12:41 AM
  5. Dynamic column length in macro
    By Digger442 in forum Excel General
    Replies: 4
    Last Post: 06-06-2007, 02:40 PM
  6. [SOLVED] Macro code to autosum a dynamic length column
    By SlowPoke in forum Excel General
    Replies: 3
    Last Post: 03-31-2006, 06:55 PM
  7. [SOLVED] Zero Length Dynamic Range
    By Ken McLennan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-15-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