+ Reply to Thread
Results 1 to 6 of 6

Use cell value to define a range

  1. #1
    Forum Contributor
    Join Date
    01-25-2010
    Location
    Virginia
    MS-Off Ver
    Excel 2013
    Posts
    104

    Use cell value to define a range

    I want to be able to enter a value into say cell B2. Let's say that value is 30 to start.

    I then want to count how many times "Not" appears in the 30 cells from E9 and going to E9+30.

    If I change that value in cell B2 to 40, then I want to count how many times "Not" appears in the 40 cells from E9 and going to E9+40.

    I tried making cell B2 be a Defined Name, but couldn't get that to work.

    I'm thinking of something that is conceptually like: =COUNTIF(E9:E9+value of B2, "Not").

    How can I do this?
    Last edited by SueWithQuestion; 08-31-2010 at 04:24 PM.

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Use cell value to define a range

    =COUNTIF(OFFSET(E9,0,0,B2,1), "Not")
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Contributor
    Join Date
    01-25-2010
    Location
    Virginia
    MS-Off Ver
    Excel 2013
    Posts
    104

    Re: Use cell value to define a range

    Wonderful - thank you!
    Last edited by NBVC; 08-31-2010 at 04:43 PM. Reason: Deleted quoting of whole post.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Use cell value to define a range

    We all know that DO will come here to tell you to avoid volatile OFFSET....

    so he might offer: =COUNTIF(E9:INDEX(E:E,8+B2), "Not") or similar as a non-volatile alternative.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  5. #5
    Forum Contributor
    Join Date
    01-25-2010
    Location
    Virginia
    MS-Off Ver
    Excel 2013
    Posts
    104

    Re: Use cell value to define a range

    Quote Originally Posted by NBVC View Post
    We all know that DO will come here to tell you to avoid volatile OFFSET....

    so he might offer: =COUNTIF(E9:INDEX(E:E,8+B2), "Not") or similar as a non-volatile alternative.
    Thank you for your post.

    What do you mean by "volatile OFFSET"?

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Use cell value to define a range

    Volatile formulas are formulas that recalculate whenever the workbook calculates, even if none of their direct input values have changed. OFFSET is one of those - it has to be because the range you are using is not actually passed directly to the formula.
    In point of fact, the INDEX formula NBVC is semi-volatile anyway (it recalculates whenever the workbook is opened.
    If you don't have many of these formulas, or a large complex workbook, there is no real need to avoid volatile formulas as the impact on performance will be negligible.

+ 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