+ Reply to Thread
Results 1 to 9 of 9

Defining Dynamic ranges

  1. #1
    Registered User
    Join Date
    09-30-2008
    Location
    ca
    MS-Off Ver
    excel 2007
    Posts
    19

    Defining Dynamic ranges

    I'm trying to make ranges in a SumProduct formula dynamic, but getting errors #N/A. I think this is because the top two rows are headers, throwing off the range count.
    Q. How do I adjust the range definition to compensate., e.g.

    Range =Offset(Sheet1!$D$3,0,0,COUNT(Sheet1!$D:$D),1) where column D is numeric, and

    Range = Offset(Sheet1!$T$3,0,0,Match("*",Sheet1!$T:$T,-1),1) where column T is text?

    I had assumed that the offset value 3 would do this, but I suspect the functions count and match are not doing so.

    Thanks for your attention.
    Last edited by kysaul; 10-07-2008 at 05:40 PM.

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    Hi

    I think you'd need to start Match at A3:Aend to get that to work. Alternatively, adjust the Match return:

    Range = Offset(Sheet1!$T$3,0,0,Match("*",Sheet1!$T:$T,-1)-2,1)

    Richard
    Richard Schollar
    Microsoft MVP - Excel

  3. #3
    Registered User
    Join Date
    09-30-2008
    Location
    ca
    MS-Off Ver
    excel 2007
    Posts
    19

    Defining Dynamic Range

    Thanks for reply.
    The 'A:Aend' gives me a formula error, I'm not familiar with that function.
    Adjusting Match return works! Adjusting Count doesn't. Any idea why? Thanks again

  4. #4
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    re: Defining Dynamic ranges

    kysaul,

    Your request confuses me.
    You talk about sumproduct, but I see non. The #N/A result is when you are multiplying (sumproduct) with a #N/A. The #N/A comes up when the result of Match was unsuccesfull.

    Next A:Aend is just to say the list is ending, limited like A1:A6. It is not a function.

    The result of =Offset(Sheet1!$D$3,0,0,COUNT(Sheet1!$D:$D),1) is a range and not a value. Count() results in a number and that is your new rowsize.

    The Match find the last String value and therefore =Offset(...match()..) results in a single cell.

    Your Title is "defining dynamic ranges". is this to be used in a chart? If so, please use these examples:
    XVALS=OFFSET($D$1,1,0,COUNTA($T:$T),1) Xseries
    YVALS=OFFSET($T$1,1,0,COUNTA($T:$T),1) Values
    Where $T$1 and $D$1 are the headers.
    =SERIES(,Book1!XVALS,Book1!YVALS,1)
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  5. #5
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    Quote Originally Posted by kysaul View Post
    Thanks for reply.
    The 'A:Aend' gives me a formula error, I'm not familiar with that function.
    Adjusting Match return works! Adjusting Count doesn't. Any idea why? Thanks again
    When i said A3:Aend I actually meant the equivalent of A3:A65536 (assuming xl2003 or below) or A3:A2000 assuming that encompassed your entire data rows. Match returns a position within the specified range relative to the start of that range whereas count returns the number of numeric cells in the given range - they are performing two different things.

  6. #6
    Registered User
    Join Date
    09-30-2008
    Location
    ca
    MS-Off Ver
    excel 2007
    Posts
    19

    Defining Dynamic ranges

    Greetings,
    Sorry to confuse. The original full formula for the column is:-
    =SUMPRODUCT((rPAPSConcatName=$T3)*((rPapDone<=$D3+400)-(rPapDone<$D3+1))*(rPAPSTestDone=$E3))
    which produces error #N/A. On evaluating the formula the error is generated by the named ranges, I think , because my original definitions

    =OFFSET(PAPS!$D$3,0,0,COUNT(PAPS!$D:$D),1) and
    =OFFSET(PAPS!$T$3,0,0,MATCH("*",PAPS!$T:$T,-1),1)

    included two header rows at the top. I'm unsure as to how to modify the definitions to exclude them. Defining the ranges
    egc =OFFSET(PAPS!$D$3,0,0,COUNT(PAPS!$D$3:$D$500),1)
    gets rid of the errors but defeats the purpose of making them dynamic.
    R.Schollar's suggestion gets rid of the error with the MATCH definition but for some reason, not with the Count one. My question is why?

  7. #7
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    You should be able to use the same MATCH function (using the same range as the match ie column T NOT column D) in place of your count.

    Richard

    Edit: if you are not getting this to work, please post both your DNR formulas incorporating the above suggestion.

  8. #8
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    Or better still, if your column T formula using MATCH is called rng1 then base your column D DNR off of it using:

    =OFFSET(rng1,0,-15)

    I may have the -15 wrong - whatever the offset from colT to col D is.

  9. #9
    Registered User
    Join Date
    09-30-2008
    Location
    ca
    MS-Off Ver
    excel 2007
    Posts
    19

    Defining Dynamic ranges

    Greetings,
    I've found the problem, stupid one. Somehow the column header had been changed to a number, increasing the count value by one, causing the #N/A error. All now works after adjusting the Match formula. Thanks.
    The evaluate formula box is very small to display the values. Is there any way to increase its size, also the formula bar box besides the Fx button?

+ 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. Naming dynamic ranges with VBA and INDIRECT
    By inky in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2008, 06:53 PM
  2. name dynamic ranges with VBA
    By robotlust in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-02-2008, 01:04 PM
  3. Look Dynamic Named Ranges
    By peterkiukas in forum Excel General
    Replies: 11
    Last Post: 11-30-2007, 03:45 PM
  4. Stacking dynamic ranges
    By Steven Fleck in forum Excel General
    Replies: 7
    Last Post: 11-21-2007, 02:42 PM
  5. Problems with SumProduct and Dynamic Ranges
    By ThrowerMatt in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-18-2007, 07:38 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