+ Reply to Thread
Results 1 to 2 of 2

Making the row number in a cell reference be variable?

  1. #1
    Registered User
    Join Date
    10-23-2017
    Location
    Boston, MA
    MS-Off Ver
    Excel 365
    Posts
    73

    Making the row number in a cell reference be variable?

    On a sheet, I have 35 cells that use B14:B22 as parameter values, and another 6 cells each that have D14:D22 through I14:I22.

    However, I add new data now and then, and this increases the range I need. It would be a real bummer to have to update all instances of 22 to 23, and then again at some point from 23 to 24. Since I'm adding the new data to end of the list rather than inserting it, Excel doesn't automatically update the arrays.

    I had an idea but I haven't been able to figure out how to implement it exactly. I have a cell J14 that contains the number of rows of data for B14 through B-whatever. What I want is basically to have all the previous instances of B14:B22 changed to B14:B(13+J14), but that syntax doesn't work. But I think you can see what I'm trying to do. How would I go about doing this?

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Making the row number in a cell reference be variable?

    Pick a column that has data.

    =Match("zzzzzzz",A:A) will return the last row with text in column A.

    =MATCH(99^99,A:A) will return the last row with numbers in column A.

    So that is your row number.

    So instead of =Sum( B14:B22) use =Sum(indirect("B14:B" & MATCH(99^99,A:A))
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

+ 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. How do I add a variable row number into a SumIf formula cell reference
    By Whit01 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-16-2013, 06:19 AM
  2. What is the syntax to reference a number in a cell using a variable?
    By dcebulsk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2012, 04:42 PM
  3. [SOLVED] reference a cell a variable number of positions away
    By kamelkid2 in forum Excel General
    Replies: 2
    Last Post: 05-22-2012, 01:07 PM
  4. Making a file and worksheet reference into a variable....
    By Bernard Liengme in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-06-2005, 04:05 AM

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