I have a Data Connection within my Excel Workbook (2007) which references a table within another Excel workbook. I have a cell that is referencing a date value within the last column header of the table. Each time the external workbook is updated and this date value changes, the cell reference in my workbook is broken and the cell shows #REF!

In case it helps I'm using a Database Query.

Connection string: {Replaced Path and Workbook Name}

DBQ=PATH\WORKBOOKNAME.xlsx;DefaultDir=PATH;Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DriverId=1046;FIL=excel 12.0;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;ReadOnly=1;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;

Command text: {Replaced Path}

SELECT * FROM `PATH\WORKBOOKNAME.xlsx`.`Main$` `Main$` ORDER BY `Main$`.IP

This is what the cell value in Column H looks like before the refresh:

enter image description here

This is what the cell value in Column H looks like after the refresh:

enter image description here

This last column header of this table contains a date value which will change each time the source workbook is updated (Volatile Date in source workbook). Technically this date field is not part of the other workbook table. However, the data connection is still pulling it and including it into the table on the main worksheet. I would not be able to modify the other workbook table and format without changing several other things due to other dependencies. I'm not sure of any other way to really reference a dynamic table header or correctly reference this cell so that the reference is not broken...

I'd like to do this within the cell formula without having to use a Macro if at all possible.

Any help is greatly appreciated. Thank You.

有帮助吗?

解决方案 2

I guess the solution was as simple as using Indirect...

=INDIRECT("G1")

其他提示

The header of the table should not change if you consider it used as a database field name. I can think a workaround as you directly give a range name to the date column in source book, for example, "Dates". Then in your other book, just make cells point to this range in source book, ie. make cells=[sourcebookname.xlsx]!Dates

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top