+ Reply to Thread
Results 1 to 11 of 11

Formula to calculate sum with file referenced in cell (similar to CONCATENATE)

  1. #1
    Registered User
    Join Date
    10-11-2010
    Location
    US
    MS-Off Ver
    NA
    Posts
    41

    Red face Formula to calculate sum with file referenced in cell (similar to CONCATENATE)

    I want to reference the content of of D13 in the below formula:

    SUM('[BRT Weekly Resource Report_3-22-11.xls]BRT Report'!$S$7:$S$25)

    Cell D13 current has the text value:

    C:\Documents and Settings\g1gq\Desktop\Weekly Resource Report\Source Data\BRT Weekly Resource Report_3-22-11.xls

    Cell D13 is populated (value only) as files are imported. I know there is a method to program this reference, I just can't remember it for the life of me.

    Thanks in advance
    Last edited by ggremel; 04-03-2011 at 09:37 PM.

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Formula to calculate sum with file referenced in cell (similar to CONCATENATE)

    Are you trying to think of INDIRECT() maybe?

    http://www.excelfunctions.net/Excel-...-Function.html

  3. #3
    Registered User
    Join Date
    10-11-2010
    Location
    US
    MS-Off Ver
    NA
    Posts
    41

    Re: Formula to calculate sum with file referenced in cell (similar to CONCATENATE)

    Quote Originally Posted by Cutter View Post
    Are you trying to think of INDIRECT() maybe?

    http://www.excelfunctions.net/Excel-...-Function.html
    Perhaps, I need help in talking the full file name (currently in D13) and run a sum on the workbook being referenced in D13.

    Within the same workbook I have SUM('BRT Report'!G7:G3000) to calculate this total. Now I need to somehow reference D13 to pull in C:\Documents and Settings\g1gq\Desktop\Weekly Resource Report\Source Data\BRT Weekly Resource Report_3-22-11.xls into another formula to caculate the total on this workbook.

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Formula to calculate sum with file referenced in cell (similar to CONCATENATE)

    Try this:

    =SUM(INDIRECT("'["&D13&"]BRT Report'!$S$7:$S$25"))
    Last edited by Cutter; 03-27-2011 at 05:27 PM.

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Formula to calculate sum with file referenced in cell (similar to CONCATENATE)

    Correction (had the square bracket in wrong place):


    =SUM(INDIRECT("'"&SUBSTITUTE(D13,"\","\[",6)&"]BRT Report'!$S$7:$S$25"))

  6. #6
    Registered User
    Join Date
    10-11-2010
    Location
    US
    MS-Off Ver
    NA
    Posts
    41

    Re: Formula to calculate sum with file referenced in cell (similar to CONCATENATE)

    I am receiving a #ref! file on both formulas. I uploaded two files with the macro and reference cells with sample data.

    It looks like we are getting somewhere in this direction. Let me know your thoughts.

  7. #7
    Registered User
    Join Date
    10-11-2010
    Location
    US
    MS-Off Ver
    NA
    Posts
    41

    Re: Formula to calculate sum with file referenced in cell (similar to CONCATENATE)

    Got it. Sum requires the file open. Very good. I just need to generate a sum product and we are rolling.

    Thank you!

    By the way, how do we mark this feed solved?

  8. #8
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Formula to calculate sum with file referenced in cell (similar to CONCATENATE)

    Ahhh, very good. I was wondering about that.

    Click on the FAQ button at top of page - the instructions are there.

  9. #9
    Registered User
    Join Date
    10-11-2010
    Location
    US
    MS-Off Ver
    NA
    Posts
    41

    Re: Formula to calculate sum with file referenced in cell (similar to CONCATENATE)

    I must be missing something else. If the file is open, it works. If I close it and press F9 it goes to #ref!. Any thoughts?

    =SUMPRODUCT(INDIRECT("'"&SUBSTITUTE($D$13,"\","\[",6)&"]BRT Report'!G$7:G$3000"))

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Formula to calculate sum with file referenced in cell (similar to CONCATENATE)

    INDIRECT doesn't work on closed files. MoreFunc's Indirect.Ext does.
    Entia non sunt multiplicanda sine necessitate

  11. #11
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Formula to calculate sum with file referenced in cell (similar to CONCATENATE)

    It turns out that INDIRECT() will only work when the file is open - no workaround.

    There is an alternative but you would need the Morefunc Addin which has INDIRECT.ext that can reference a single cell on a closed file.

    Here's some info:

    http://www.dailydoseofexcel.com/arch...sed-workbooks/
    Last edited by Cutter; 03-27-2011 at 07:27 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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