Hello all,
I have run into a little snag and much frustration when trying to lookup values from a closed workbook. I was able to use sumproduct to look up a value from a closed workbook and it looks like it is working OK.
In the closed workbook "test book.xlsx", there is data on the sheet "2000" that I want to look up. One criteria is in column A and matched to a cell on my current sheet (F15), another in column B matched to another criteria (G15), and I want to return the matching sum in column D of the closed workbook. This code works.
The problem now becomes that I want to use the values typed into a cell to reference where the path of the file name, the name of the reference workbook, and the sheet name. These would be typed into different cells. For example, I would put something like "C:\test\[test book.xlsx]" in one cell, and "2000" in another cell and those values would be used as variables in the sumproduct formula. The goal would be to be able to enter new values in those cells based on where the workbook is saved, what the file name is, and what the sheet is named, and have the formula recalculate using the new information.
I can't seem to use cell values in my sumproduct formula. I've searched the forums here and saw things about the "pull" function (but won't work with Excel 2007?), some UDF functions with VBA code using "evaluate" to get the sumproduct... but I'm not making sense of it so nothing is working.
Can this variable-filled formula be used in Excel or is there something else I can try? I'm having problems with the correct way to write the formula so any help would be greatly appreciated. Thanks!
I have run into a little snag and much frustration when trying to lookup values from a closed workbook. I was able to use sumproduct to look up a value from a closed workbook and it looks like it is working OK.
Code:
=SUMPRODUCT(--('C:\test\[test book.xlsx]2000'!$A$1:$A$1000=F15),--('C:\test\[test book.xlsx]2000'!$B$1:$B$1000=G15),('C:\test\[test book.xlsx]2000'!$D$1:$D$1000))
In the closed workbook "test book.xlsx", there is data on the sheet "2000" that I want to look up. One criteria is in column A and matched to a cell on my current sheet (F15), another in column B matched to another criteria (G15), and I want to return the matching sum in column D of the closed workbook. This code works.
The problem now becomes that I want to use the values typed into a cell to reference where the path of the file name, the name of the reference workbook, and the sheet name. These would be typed into different cells. For example, I would put something like "C:\test\[test book.xlsx]" in one cell, and "2000" in another cell and those values would be used as variables in the sumproduct formula. The goal would be to be able to enter new values in those cells based on where the workbook is saved, what the file name is, and what the sheet is named, and have the formula recalculate using the new information.
I can't seem to use cell values in my sumproduct formula. I've searched the forums here and saw things about the "pull" function (but won't work with Excel 2007?), some UDF functions with VBA code using "evaluate" to get the sumproduct... but I'm not making sense of it so nothing is working.
Can this variable-filled formula be used in Excel or is there something else I can try? I'm having problems with the correct way to write the formula so any help would be greatly appreciated. Thanks!