+ Reply to Thread
Results 1 to 8 of 8

variable range within sumproduct

  1. #1
    Forum Contributor
    Join Date
    02-01-2011
    Location
    london, england
    MS-Off Ver
    Excel 2016
    Posts
    179

    variable range within sumproduct

    I have the formula below, which calculates a percentage of information received on time - however, this needs to be a variable range, and if i state empty cells to anticipate additions it includes them when calculating the percentage? can anyone help me?

    Please Login or Register  to view this content.
    Last edited by fabrecass; 01-22-2013 at 04:36 AM.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: variable range within sumproduct

    I assume the values in columns L and M are numeric? (you can test TEXT for that same condition)

    Is the data contiguous? In other words, are there any empty cells within the data range?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Contributor
    Join Date
    02-01-2011
    Location
    london, england
    MS-Off Ver
    Excel 2016
    Posts
    179

    Re: variable range within sumproduct

    the values in L and M are all dates, so yes, numeric. and yes the data is contiguous.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: variable range within sumproduct

    Create these dynamic named ranges...

    Goto the menu Insert>Name>Define

    Name: Rng1
    Refers to:

    =$L$2:INDEX($L$2:$L$1000,MATCH(1E100,$L$2:$L$1000))

    Name: Rng2
    Refers to:

    =$M$2:INDEX($M$2:$M$1000,MATCH(1E100,$L$2:$L$1000))

    Adjust for a reasonable end of range where I use down to row 1000.

    Then, your formula becomes:

    =SUMPRODUCT(--(Rng1>Rng2))/ROWS(Rng1)

    If there are no entries in the ranges then the formula will return an #N/A error.

  5. #5
    Forum Contributor
    Join Date
    02-01-2011
    Location
    london, england
    MS-Off Ver
    Excel 2016
    Posts
    179

    Re: variable range within sumproduct

    Thank you Tony - i shall test this now - will it work across 2 worksheets? so the formula on one sheet and the data on another.

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: variable range within sumproduct

    Quote Originally Posted by fabrecass View Post
    will it work across 2 worksheets? so the formula on one sheet and the data on another.
    Yes. Just make sure to include the appropriate sheet names when creating the dynamic ranges.

  7. #7
    Forum Contributor
    Join Date
    02-01-2011
    Location
    london, england
    MS-Off Ver
    Excel 2016
    Posts
    179

    Re: variable range within sumproduct

    thank you Tony, your solution worked perfectly.

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: variable range within sumproduct

    You're welcome. Thanks for the feedback!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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