+ Reply to Thread
Results 1 to 4 of 4

Dynamic sheet name in formula

  1. #1
    Registered User
    Join Date
    09-08-2011
    Location
    london, england
    MS-Off Ver
    Excel 2003
    Posts
    2

    Dynamic sheet name in formula

    I have a workbook that is running a SUMPRODUCT on another workbook.

    Here is the formula:

    =SUMPRODUCT(--('U:\My Documents\[workbook1.xls]sheet1'!$C$3:$C$12=$A2),--('U:\My Documents\[workbook1.xls]sheet1'!H$3:H$12="no"))

    This formula works great.

    But I would like the sheet name to, instead of being hardcoded as "sheet1" draw from cell A1 to get the name of the sheet to be used.

    I have tried this and it gives an immediate error:


    =SUMPRODUCT(--('U:\My Documents\[workbook1.xls]&A1'!$C$3:$C$12=$A2),--('U:\My Documents\[workbook1.xls]&A1'!H$3:H$12="no"))

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Dynamic sheet name in formula

    You will need INDIRECT function for that... and that function does not work with closed workbooks. Is that ok? and if not, there is a free addin that you can use, is that ok?
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    09-08-2011
    Location
    london, england
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Dynamic sheet name in formula

    Quote Originally Posted by NBVC View Post
    You will need INDIRECT function for that... and that function does not work with closed workbooks. Is that ok? and if not, there is a free addin that you can use, is that ok?
    Unfortunately, neither of those are ok. Workbooks need to be closed and an addon won't be possible either.

    Are you sure there's no way to modify my formula?

    The formula already correctly grabs data from a closed workbook. All it needs to do is get the "Sept 7" part of its string from a cell.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Dynamic sheet name in formula

    Unfortunately, you need to refer to that cell in an indirect manner..

    here are your options: INDIRECT alternatives for Outside Workbooks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1