Can I use a variable for the row number in a range?

Anonymous
2019-02-25T20:13:02+00:00

% average Error is based on rows in column N

Average Reading calculation is based on column F

Average Dose calculation is based on column G

The two charts are based on the same rows and columns.

The all use the same rows. In this case rows 12 - 52.

Note the two cells for Start and Stop.

All of this is working....

The complication is that I want to copy/paste this information to another location below this one.

Then copy/paste in new data for the chart.

The new data may have more, or fewer, rows of data.

I want to change the cells for Start/Stop values and have each formula update the respective ranges.

A formula might look something like this:

=AVERAGEIF($N$[value in cell T10]): $N$[value in cell U10])

and in another fornual:

=AVERAGE($F$[value in cell T10]:$F$[value in cell U10])

I have considered:

=AVERAGEIF($N$[T10.value]): $N$[U10.value])

but it did not work.

This way, for the new cluster of readings, each formula will update and all I have to do is enter a new value for the new start and new stop.

There may be other ways to do this and I will consider them but for my own curiosity: 

Can I set a variable for the row value in a formula?

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. HansV 462.4K Reputation points MVP Volunteer Moderator
    2019-02-25T20:26:53+00:00

    You can use the INDIRECT function for this. For example:

    =AVERAGE(INDIRECT("F"&T10&":F"&U10))

    and

    =AVERAGEIF(INDIRECT("N"&T10&":N"&U10),"<>0")

    0 comments No comments
  2. Anonymous
    2019-02-25T23:25:27+00:00

    Close but no cigar...  The plot thickens...

    The reference cells have been changed to columns X and Y but this doesn't change the issue.

    The next problem is that the cells for the variables are X14 and Y14 position for only that section. 

    The next section below that in X57 and Y57. 

    Then X100 and Y100,

             X141 and Y141,

             X178 and Y178, etc...

    The number of rows in each section is not constant.

    There is a page break 2 rows above there reference cells if that helps.

    They are two rows below the title for each section.

    Without this fix I will have to update the two graphs and each formula in column V for each new section when the sensor is changed.  The clerks who will be running the lab can, at best understand the copy/paste but I doubt they will grasp the how to modify the graphs. 

    0 comments No comments