+ Reply to Thread
Results 1 to 18 of 18

INDIRECT formula doesn't update automatically from an external worksheet

  1. #1
    Registered User
    Join Date
    01-31-2013
    Location
    CA
    MS-Off Ver
    Excel 2016
    Posts
    9

    INDIRECT formula doesn't update automatically from an external worksheet

    I have an INDIRECT formula in my worksheet that is using cell references to an other excel file. It is not updating the values unless I open the external file along with my working file.
    Is there anyway that that will make this work? I don't want to be able to open the other file every time I use it.
    Thank you.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    That is the way Excel is designed. There may be work-arounds but I think we'd need to see the two worksheets in question.
    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    01-31-2013
    Location
    CA
    MS-Off Ver
    Excel 2016
    Posts
    9

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    Hi dflak,

    I attached the two files. TEST is the one I am using INDIRECT function (cells C20:C50 & D20:D50) to import the daily door swings and phone calls from the external excel sheet (MAIN CALL & DOOR LOGS 2017.xlsx).
    Our receptionist is keeping this file and updating it everyday. This file is located on our network drive Z. File location is in cell Q51 on TEST.xlsx.
    There is no access violation issues. Before i was using just the regular links to populate those numbers but for each month, our sales managers needed to replace the month name on the file so the TEST imports the correct month's numbers.
    I am trying to use INDIRECT function so that just by changing the month on TEST cell B18, those numbers will be populated correctly. But the problem is unless i open the other file, it gives me #REF error.
    Hope this explanation is helpful.
    Thank you.
    Attached Files Attached Files

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    The only way I can see to get out of this is to use VBA to rewrite the formulas in lieu of INDIRECT. The code could be set up to fire automatically when you change the value in Cell B18. Would you be interested in such a solution?

  5. #5
    Registered User
    Join Date
    01-31-2013
    Location
    CA
    MS-Off Ver
    Excel 2016
    Posts
    9

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    Sure dflak, if it will work for sure, why not.
    Thanks a lot.

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    I made a few changes to the spreadsheet. I moved the value in Q51 to the Loolups page and gave it a name, DARB. If you change the location of the spreadsheet or the name of the spreadsheet, change cell B1 on the Lookups page.

    I listed out the months, gave it a name List_Months and used it as data validation for Cell B18 on the Input Page. I also calculated the last date for the selected month and gave it a name EOM_Date.

    OK, by now you should get the idea that I like using names They make formulas easier to understand.
    Here is more information on names: http://www.utteraccess.com/wiki/Offs...Dynamic_Ranges - all these names are static.

    You can hide the lookups page if you wish.

    I then changed the formulas for the dates so that only dates for the selected months show.

    When you select a month in Cell B18, the program generates the formulas in columns C and D. I have no way of testing this, so I need you to inspect the formulas (and check what they yield) to make sure I created the correct formulas.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    01-31-2013
    Location
    CA
    MS-Off Ver
    Excel 2016
    Posts
    9

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    WOW dflak. It works like a charm. Thank you so much. I i kind of followed what you did (i agree with naming formulas, etc. I'll definitely use that from now on) but I couldn't figured out how you change the links on C29:D50 to update with the selected month.
    Also can we use a similar aproach for celss C, D, E & E 68? Those cells are pulling data from a different external file as well. But the tab names are different as you can see (November vs Nov-17). I can change the tab names on the second file and make them the same as the first one to be just the month if it makes things easier.
    Thank you again for sharing the knowledge.

    E.

  8. #8
    Registered User
    Join Date
    01-31-2013
    Location
    CA
    MS-Off Ver
    Excel 2016
    Posts
    9

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    One more thing, i noticed that when i protect the sheet, it it doesnt update the values. Is it because of the file format? It is nice to protect it just in case someone deletes a formula by mistake and calls me to fix it. This is for our Sales Managers to use, not me.
    Thanks once again.

  9. #9
    Registered User
    Join Date
    01-31-2013
    Location
    CA
    MS-Off Ver
    Excel 2016
    Posts
    9

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    I updated C68, D68, E68 & F68 with Month names on the tabs. Also updated the links files of course.
    Also changed OEM_Date name to point to H17 on Input Page instead of Lookups. I try to keep as little as possible on Lookups.
    But i still cant figure out how the links updates as you change the month from B18.
    Attached Files Attached Files

  10. #10
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    If you press ALT-F11, it brings up the VB project browser. If you select (Input Page), you will see that there is some "special" code there. This particular code is called a change event. What this code says is that if you change the value of cell B18 run the program MakeFormulas.

    Make formulas is in the Module ModMakeFormula - I rename my modules to help me remember what's in them. The subroutine MakeFomulas does, in VBA, what you were doing with the INDIRECT. It makes a string that looks like a formula. In this case, since we assign it to a cell, it becomes an actual formula as if it were typed in.

    You can keep the naming conventions for the tabs referenced in row 68 as you have them now. I'l work that into the code / formulas.

    I am making an assumption that this is a year-to-date sheet, and that you may want to do the same thing in 2018. I'll add a cell where you can specify the year and that will carry over to all the formulas and replace 2017 wherever it appears (entering 2017, of course will replace 2017 with 2017 - so nothing happens there ).

    As for protecting the sheet. I can add code that unprotects it, runs the code and reportects it before the users can get their hands on it. Do you want a password protection on it or are you just protecting the sheet to keep people from doing things accidentally?

  11. #11
    Registered User
    Join Date
    01-31-2013
    Location
    CA
    MS-Off Ver
    Excel 2016
    Posts
    9

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    It gets better and better...
    I already change the tab names on the linked file to Month Names from Jan-17, etc.
    Yes, this will be redone for 2018 so that year selection will be awesome.
    No password protection needed, just to protect it from accidental changes.
    Thank you once again. I am trying to follow your code to learn how you did it. Hopefully i can catch something here and there.

  12. #12
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    Here is version 2.0.

    On the lookup sheet, I added a cell to add the year.

    There are now two cells that have the string to point to the source file. Be careful with these in that they are not static. They are actually formulas that look at the year and in the case of Row 68, also the selected month.

    Once I got these working, I tacked on a couple more lines of code to do row 68 and wrapped the code between statements to unprotect and reprotect the sheet.
    Attached Files Attached Files

  13. #13
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    I use the macro recorder to get the syntax of how to do somethings. I never did commit to memory how to protect and unprotect a sheet, so I recorded the macro and then modified the statements. The macro recorder is at least that good.

    If you have any question about anything I did in the code, just ask.

    If you think you will be playing with VBA, the very first thing you should do is arrange to have Option Explicit put on the first row of each module. The instructions on how to do this follow:

    It is a best practice to declare all variables. If you misspell a variable in your code, VBA will silently assume it is a Variant variable and go on executing with no clue to you that you have a bug. Go to the VBA development window, click Tools, Options, and check "Require Variable Declaration." This will insert the following line at the top of all new modules:
    Please Login or Register  to view this content.
    This option requires all variables to be declared and will give a compiler error for undeclared variables.

  14. #14
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    We cross posted - you changed mmm-yy to the full month name. You can (a) change them back or (b) play with the formula in cell B3 on the lookups sheet. Changing LEFT(Sel_Month,3) to Sel_month should do it.

  15. #15
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    It's a good thing you made me go back and look at the formula in cell B3. I missed a couple of 2017s.
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    01-31-2013
    Location
    CA
    MS-Off Ver
    Excel 2016
    Posts
    9

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    dflak,

    Everything works good except the 68 row. It's not updating. I have to open the feeding file and then it updates but when i close that file and change the month, it doesnt update row 68 anymore.
    Other ones updates all the time. I attached the final version of what will be used with all other tabs in it.
    Thank you.

    E.
    Attached Files Attached Files

  17. #17
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    That sounds odd. If it is going to fail, it should fail even when the source file is open.

    Check that the formula I created is valid. Manually create a the formula in the cell below and compare. Also try pressing F9. Let me know if the formulas are different or if F9 makes it happen.

  18. #18
    Registered User
    Join Date
    01-31-2013
    Location
    CA
    MS-Off Ver
    Excel 2016
    Posts
    9

    Re: INDIRECT formula doesn't update automatically from an external worksheet

    Guess what, after opening and closing all the files and using F9 couple times it now seems to be working.
    Thank you so much for your time and help.

    E.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Can one make a copy of a worksheet and have the 3D reference formula automatically update?
    By Sherip46 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-16-2016, 07:18 PM
  2. INDIRECT doesn't play nicely with external links...Help!
    By tbarclay in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-09-2014, 11:26 AM
  3. [SOLVED] Automatically open and close external workbook for indirect function
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-03-2013, 01:49 PM
  4. Replies: 0
    Last Post: 10-10-2013, 04:53 AM
  5. Diagram doesn't update automatically?
    By Kribulin in forum Excel General
    Replies: 5
    Last Post: 06-05-2008, 05:47 AM
  6. INDIRECT update with external workbook
    By papa_face in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 05-03-2008, 06:24 AM
  7. [SOLVED] Self Defined Function Doesn't Update Automatically
    By Peter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2006, 10:40 AM

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