I have an array in one file, for example:
Names Age Shoe Size
Andrew 19 12
Mary 17 8
Sarah 15 10
Wesley 19 11
I want to pinpoint one piece of data based on a given name and data type.
For example, pinpoint Sarah and Age, I want the cell to read 15.
I have read this helpful guide on Double Lookups, but one thing is still bothering me.
Here is the formula:
=OFFSET(A1:C5,MATCH("Sarah",OFFSET(A1:C5,0,0,ROWS(A1:C5),1),0)-1,MATCH("Age",OFFSET(A1:C5,0,0,1,COLUMNS(A1:C5)),0)-1)
It works when the data is in the same file, however when I try and use the given formula from another file, it gets a #VALUE! error.
Code for reading from anther file (all I did was add the file path):
=OFFSET(C:file\path\'[Lister.xls]Shhet1'!$A$1:$C$5,MATCH("Sarah",OFFSET(C:file\path\'[Lister.xls]Shhet1'!$A$1:$C$5,0,0,ROWS(C:file\path\'[Lister.xls]Shhet1'!$A$1:$C$5),1),0)-1,MATCH("Age",OFFSET(C:file\path\'[Lister.xls]Shhet1'!$A$1:$C$5,0,0,1,COLUMNS(C:file\path\'[Lister.xls]Shhet1'!$A$1:$C$5)),0)-1)
Here it is spaced so it is easier to read:
=OFFSET(C:file\path\'[Lister.xls]Shhet1'!$A$1:$C$5,
MATCH("Sarah", OFFSET(C:file\path\'[Lister.xls]Shhet1'!$A$1:$C$5, 0, 0,
ROWS(C:file\path\'[Lister.xls]Shhet1'!$A$1:$C$5),1), 0)-1,
MATCH("Age", OFFSET(C:file\path\'[Lister.xls]Shhet1'!$A$1:$C$5, 0, 0, 1,
COLUMNS(C:file\path\'[Lister.xls]Shhet1'!$A$1:$C$5)), 0)-1)
Does anyone know why it doesn’t like other files?
It’s the same information.
How do I fix this?
Thanks in advance 🙂
Just to expand on Scott’s answer, external paths to closed workbooks are treated like arrays not references so functions that are expecting references in arguments like OFFSET, SUMIF, or COUNTIF return errors if the workbook is closed.
INDEX on the other hand does allow arrays as arguments, so you could try entering instead:
which should allow for references to closed workbooks as well.
A further advantage of INDEX is that it is not volatile so will only recalculate when a cell in one of the dependent cells (A1:C5) changes whereas OFFSET is a volatile function and will recalculate whenever a change is made anywhere in the workbook which is less efficient.