+ Reply to Thread
Results 1 to 14 of 14

dynamic range, counta and offset combination

  1. #1
    Registered User
    Join Date
    06-22-2016
    Location
    Tokyo
    MS-Off Ver
    the latest
    Posts
    15

    dynamic range, counta and offset combination

    hi! I am trying to set a range (for a lookup). I have the start cell, but the last cell will change as records are added/removed. I think I need to offset the last cell by the number of rows that I commence my count from.

    Here is what I have so far>

    ="$A$9:$A$"&COUNTA(INDIRECT("$O$9:$O$10000")) >>(not sure why, but if I remove INDIRECT, the formulae does not work. I need the INDIRECT part for a larger function however).

    This function will count values in column O to make the range (in column A), however the range will be 8 records short becuse I need to start the count from row 9. How can I fix this without adding "+8" into my range calc?

    Thank you so much!

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: dynamic range, counta and offset combination

    Hi chomo,

    It sounds like you need to discover "Dynamic Named Ranges". See:

    http://www.bettersolutions.com/excel...G820716330.htm or
    http://www.ozgrid.com/Excel/DynamicRanges.htm
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,843

    Re: dynamic range, counta and offset combination

    Or maybe even Tables
    http://www.contextures.com/xlExcelTable01.html#ref
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  4. #4
    Registered User
    Join Date
    06-22-2016
    Location
    Tokyo
    MS-Off Ver
    the latest
    Posts
    15

    Re: dynamic range, counta and offset combination

    Thanks MarvinP, But I neglected to mention that I cannot name the range (it is a constraint I have). I need the formulae to create the range on the fly, but not name it. I have a matrix, 100X 100, with each cell refering to data throughout a very large spreadsheet. Naming ranges will create thousands of names. I am not allowed to add even a single name. How can we do this?

    So, I have the first cell. (e.g. A9)
    Next I need to jump to the last cell (there are blank cells along the way)
    Then I need excel to return the cell coordinates and plug into a larger formula. (e.g. A5000)
    The result will be A9:A5000, which I will plug into another formulae as a string.

    I appreciate any advice.

    Thanks, chomo

  5. #5
    Registered User
    Join Date
    06-22-2016
    Location
    Tokyo
    MS-Off Ver
    the latest
    Posts
    15

    Re: dynamic range, counta and offset combination

    Hi Jacc. Please see response to Marvin. I cannot name the ranges.

  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: dynamic range, counta and offset combination

    Quote Originally Posted by chomo View Post
    This function will count values in column O
    I assume that means column O contains numbers?

    =$A$9:INDEX($A:$A,MATCH(1E100,$A:$A))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  7. #7
    Registered User
    Join Date
    06-22-2016
    Location
    Tokyo
    MS-Off Ver
    the latest
    Posts
    15

    Re: dynamic range, counta and offset combination

    Hi Tony, Thanks for the tip. That did not work work. I may have input incorrectly. Please see the attached sheet with more detail of my problem. This should be much easier to grasp now. Please let me know how you go.
    Attached Files Attached Files

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: dynamic range, counta and offset combination

    This doesn't work because it's a flawed logic to the dynamic range.
    =SUMPRODUCT(--(INDIRECT($B$3&"!$D$9:$D$"&COUNTA(INDIRECT($B$3&"!$D$9:$D$10000")))=""))

    This part
    COUNTA(INDIRECT($B$3&"!$D$9:$D$10000"))
    Is counting non blanks in D9:D10000
    In your given sheet, that number happens to be 46
    But given that your ragne begins in Row 9, AND since those blanks are not contiguous, and spread out through the whole range, then 46 doesn't actually translate to a useable Row# for your range.

    So with counta returning 46, your formula is translated to
    =SUMPRODUCT(--(INDIRECT($B$3&"!$D$9:$D$46")=""))
    D9:D46 is not the actual range.


    Tony's version will work better.
    But his post appears to be just a general suggestion, and not written specifically for your ranges and formula.
    in the book you posted, you didn't really apply it to your sumproduct formula.
    Try
    =SUMPRODUCT(--($D$9:INDEX($D:$D,MATCH(1E+100,$D:$D))=""))

    You can then apply the indrect function as needed.

  9. #9
    Registered User
    Join Date
    06-22-2016
    Location
    Tokyo
    MS-Off Ver
    the latest
    Posts
    15

    Re: dynamic range, counta and offset combination

    Hi Jonmo, thanks for the guidance. The quality of this forum is tip-top. You found it! Awesome.

    I am now having difficulty joining it with the indirect function>

    =SUMPRODUCT(--(INDIRECT($B$3&"!$D$9:INDEX($D:$D,MATCH(1E+101,$D:$D)=""")))

    (where B3 is the name of the worksheet) All I get is #REF returned.

    Any ideas?

    Thanks!
    chomo
    tokio

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

    Re: dynamic range, counta and offset combination

    Try it like this...

    =SUMPRODUCT(--(INDIRECT("'"&B3&"'!D9:"&"D"&LOOKUP(1E100,INDIRECT("'"&B3&"'!D9:D10000"),ROW(INDIRECT("'"&B3&"'!D9:D10000"))))=""))

  11. #11
    Registered User
    Join Date
    06-22-2016
    Location
    Tokyo
    MS-Off Ver
    the latest
    Posts
    15

    Re: dynamic range, counta and offset combination

    WOW Tony. you r the man! Although MASSIVE, this formulae worked! Thanks so much. Any short hand for this baby!?

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

    Re: dynamic range, counta and offset combination

    Quote Originally Posted by chomo View Post
    Any short hand for this baby!?
    Eh, a little bit...

    Technically, we can do without the reference to B3 in the last INDIRECT function:

    =SUMPRODUCT(--(INDIRECT("'"&B3&"'!D9:"&"D"&LOOKUP(1E100,INDIRECT("'"&B3&"'!D9:D10000"),ROW(INDIRECT("D9:D10000"))))=""))

    You could give this section a defined name:

    ROW(INDIRECT("D9:D10000"))

    Name: Range
    Refers to: =ROW(INDIRECT("D9:D10000"))

    Then the formula becomes:

    =SUMPRODUCT(--(INDIRECT("'"&B3&"'!D9:"&"D"&LOOKUP(1E100,INDIRECT("'"&B3&"'!D9:D10000"),Range))=""))

  13. #13
    Registered User
    Join Date
    06-22-2016
    Location
    Tokyo
    MS-Off Ver
    the latest
    Posts
    15

    Re: dynamic range, counta and offset combination

    Cheers Tony! and thank you to everyone else who have helped me along the way!

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

    Re: dynamic range, counta and offset combination

    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)

Similar Threads

  1. OFFSET, COUNTA or SHOULD BE COUNTIF Function for dynamic range for Chart
    By ahteddy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-24-2015, 10:50 AM
  2. Creating Dynamic Range Using OFFSET and COUNTA Adds Extra Rows
    By jcox1953 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-25-2014, 12:44 PM
  3. [SOLVED] Offset with Counta for picture of dynamic table is adding extra row to pic
    By Steve N. in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-07-2014, 05:29 PM
  4. Offset+counta to autoselect data range for charting purposes
    By siroco79 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-17-2013, 04:50 AM
  5. Why dynamic range doesnt work with COUNTA
    By Kushal_1991 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-31-2013, 11:17 AM
  6. CountA - Dynamic Range - Macro
    By elcentro3m in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-10-2007, 02:54 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