+ Reply to Thread
Results 1 to 9 of 9

Dynamic range... stuff...

  1. #1
    Registered User
    Join Date
    05-29-2014
    Posts
    3

    Dynamic range... stuff...

    I feel like I am THIS CLOSE to having this figured out but I am missing something somewhere.

    I have two sheets. First is named overview and the second is named DATA

    I am using this statement on the overview sheet to grab data from the DATA sheet:

    =COUNTIFS(DATA!L2:DATA!L369,"Sat",DATA!M2:DATA!M369,1)+COUNTIFS(DATA!L2:DATA!L369,"Sun",DATA!M2:DATA!M369,1)

    What I need to do is dynamically set the DATA!L369 number. I am pasting data into the DATA sheet and this DATA!L369 number could be anything (the 369 could be any number but the DATA!L part always remains the same). So it needs to say, "Look in the range L2 up to whatever the last cell in column L that has data in it is"

    I have tried using a combination of COUNTA with Index but simply cannot get it right.

    Please help me Obi Wan.

  2. #2
    Forum Contributor
    Join Date
    06-21-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    191

    Re: Dynamic range... stuff...

    Lots of great info here: http://www.ozgrid.com/Excel/DynamicRanges.htm

    Dynamic Ranges are good stuff. And you're on the right path already.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Dynamic range... stuff...

    Hi and welcome to the forum

    Apart from asking for a more descriptive thread title (as per rule 1), I would ask why you need to have the length set in the 1st place?

    Why not just have...
    =COUNTIFS(DATA!$L:DATA!$L,"Sat",DATA!$M:DATA!$M,1)+COUNTIFS(DATA!$L:DATA!$L,"Sun",DATA!$M:DATA!$M,1)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  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: Dynamic range... stuff...

    The COUNTIFS function is an efficient function. Just reference the entire columns.

    =SUM(COUNTIFS(DATA!L:L,{"Sat","Sun"},DATA!M:M,1))

    If you have data down to row 375 these formulas are equally efficient:

    =SUM(COUNTIFS(DATA!L:L,{"Sat","Sun"},DATA!M:M,1))
    =SUM(COUNTIFS(DATA!L2:L375,{"Sat","Sun"},DATA!M2:M375,1))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Dynamic range... stuff...

    Post deleted

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Dynamic range... stuff...

    Thanks for the refinement, Tony

  7. #7
    Registered User
    Join Date
    05-29-2014
    Posts
    3

    Re: Dynamic range... stuff...

    Quote Originally Posted by FDibbins View Post
    Hi and welcome to the forum

    Apart from asking for a more descriptive thread title (as per rule 1), I would ask why you need to have the length set in the 1st place?

    Why not just have...
    =COUNTIFS(DATA!$L:DATA!$L,"Sat",DATA!$M:DATA!$M,1)+COUNTIFS(DATA!$L:DATA!$L,"Sun",DATA!$M:DATA!$M,1)
    To be honest - I couldn't figure out how to title this one and finally just said ... stuff. It said something like, "Dynamic range in a formula when referencing another sheet with the second number after the colon changing." Anyway, I'll try harder next time.

    Thank you for the idea here. I think I figured that referencing the entire column would error out if no data was there, but I now see that makes no sense! I'll give these a twirl. Thanks a lot!

  8. #8
    Registered User
    Join Date
    05-29-2014
    Posts
    3

    Re: Dynamic range... stuff...

    Thank you very much!

    Quote Originally Posted by Tony Valko View Post
    The COUNTIFS function is an efficient function. Just reference the entire columns.

    =SUM(COUNTIFS(DATA!L:L,{"Sat","Sun"},DATA!M:M,1))

    If you have data down to row 375 these formulas are equally efficient:

    =SUM(COUNTIFS(DATA!L:L,{"Sat","Sun"},DATA!M:M,1))
    =SUM(COUNTIFS(DATA!L2:L375,{"Sat","Sun"},DATA!M2:M375,1))

  9. #9
    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... stuff...

    You're welcome!


    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ 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. Match ComboBox with dynamic range, then add Textbox1 to dynamic range
    By Lasse Moe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-07-2014, 01:26 AM
  2. Dynamic Range Column Chart w/ Dynamic Avg Line (Excel 2007)
    By BrokenBiker in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 10-04-2012, 11:40 AM
  3. Replies: 2
    Last Post: 04-20-2012, 12:23 PM
  4. Fill Dynamic Range From Dynamic Source Range
    By goss in forum Excel General
    Replies: 2
    Last Post: 03-06-2012, 12:05 PM
  5. [SOLVED] Dynamic Range with unused formula messing up x axis on dynamic graph
    By cabybake@yahoo.com in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 02-02-2006, 04:10 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