Works, will play a little to figure out. THANKS
To explain a bit how it works, the INDEX formula returns a range reference which can be used anywhere you would normally refer to a range. The goal was to have the first range reference ALWAYS be D5. There were two ways to accomplish this:
- Use an INDIRECT formula
- Use an INDEX formula
The INDIRECT formula approach is for a last-resort, as INDIRECT is a volatile function (updates when ANY calculation is performed - very ineffecient). The INDEX function will only update when one of its precedents are updated (the cells actually referenced in the INDEX formula).
So to further explain INDEX, it has the syntax:
INDEX(
array,
[row number], [column number])
We define the
array argument to be 5:5 (aka, the entire row 5). Now, we need to tell the formula what cell we want to return. We can omit the
[row number] argument, since this is a 1-dimensional array. Now, we want to tell the formula to return the fourth column (since D is the fourth column), so we put a 4 in for the
[column number] argument.
As a result, INDEX(5:5,,4) will always point to D5, no matter how many columns you insert in your data. However, keep in mind that if you add rows above that formula, the range it references will be adjusted. So if you were to add a row above it, the formula will change itself to INDEX(6:6,,4).
Hope that explanation helps! Glad it works for you.