roscoe
Well-known Member
- Joined
- Jun 4, 2002
- Messages
- 1,046
- Office Version
- 365
- Platform
- Windows
- MacOS
I've taken great advantage of using offset to generate dynamic named ranges (for plotting to reduce data point count) such as:
...however now I find the desire to replace the hard column references within the Offset formula ("$A$3" and $A:$A") with imbedded formulas. Why? I want to be able to reoroganize and/or insert data on my worksheet without having to recode VBA as to where the data gets written. Currently doing this by using Match() against Column header names (in a table) to determine the column number ("13") in which the header occurs, and converting that to a column reference ("M"). Then in VBA I use vlookup to find the column number/reference and use those to point where the data should be written. Sounds convoluted and there's probably a better way but...
So far so good. However, I then use dynamic ranges as above to plot the data and this is where I'm stuck. I have already created strings "$A:$A" and "$A$3" from the table above but I can't seem to get the named range offset formula to work when I insert them. I get a generic error that says that my formula is wrong but without enough guidance to figure out what I need to fix (or maybe I can't do this).
The formula to determine the column reference for Header "Test" is:
where "Graph_column_Table" is the 3-column range with (1) header names (2) calculated column numbers and (3) calculated column references. When I try to insert this formula into the Offset formula above it fails:
(Note I have an even longer formula for calculating "$A:$A" but left it out to avoid any more confusion that I've already created )
Why is this failing, and is there a better way??
Thanks
Code:
=OFFSET($A$3,0,0,COUNT($A:$A),1)
So far so good. However, I then use dynamic ranges as above to plot the data and this is where I'm stuck. I have already created strings "$A:$A" and "$A$3" from the table above but I can't seem to get the named range offset formula to work when I insert them. I get a generic error that says that my formula is wrong but without enough guidance to figure out what I need to fix (or maybe I can't do this).
The formula to determine the column reference for Header "Test" is:
Code:
="'Graph Data'!$" & VLOOKUP("Test", Graph_column_Table,3,FALSE) & "$3" [produces "$A$3']
Code:
=OFFSET("'Graph Data'!$" & VLOOKUP("Test", Graph_column_Table,3,FALSE) & "$3",0,0,COUNT($A:$A),1)
(Note I have an even longer formula for calculating "$A:$A" but left it out to avoid any more confusion that I've already created )
Why is this failing, and is there a better way??
Thanks