+ Reply to Thread
Results 1 to 10 of 10

IF/IFS across multiple workbooks for direct link to main workbook?

  1. #1
    Forum Contributor
    Join Date
    03-31-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    632

    IF/IFS across multiple workbooks for direct link to main workbook?

    Hi all,

    This one may be a bit tricky. I have a hard time uploading a workbook sample since the data is sensitive and there are three workbooks, but if needed be, I'll try to create a mock-up which I can upload for testing.

    Details:

    I have Workbook 1 which is always open. This is my main workbook.

    This workbook have a column (H) which imports/links data in a column from Workbook 2 or 3, but should only do so if the dates in WB 1 and WB 2 or 3 are equal.

    It's random if I have WB2 or WB3 open (or updated) at the same time, so the idea is to create link which will grab data from whichever WB is open.

    Following this, I wanted to create an IF statement which

    first checks if WB1 Date = WB2 Date and if so, returns values from column E in WB2.

    if not, it should check if WB1 Date = WB3 Date and if so, return values from Columnn E in WB3.

    I've tried implementing this both using a regular IF and finally IFS:

    =IFS([@Date]=WB2.xlsm!SeriesTable[@Date],WB2!SeriesTable[@H],[@Date]='WB3'!SeriesTable[@Date],'WB3'!SeriesTable[@H])
    What invariably happens is that if I open WB1 without the other two - I get #REF upon receiving new data.

    If I open WB2 - WB1 updates perfectly.

    However, if I open WB3 (without first opening WB2), it's still #REF.

    My conclusion is that perhaps IF/IFS does not work across multiple workbooks, then. And that I maybe just have to accept that this is not possible.

    Any thoughts?

    Thanks in advance.
    Attached Images Attached Images
    Last edited by Elijah; 01-17-2021 at 01:23 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: IF/IFS across multiple workbooks for direct link to main workbook?

    Pretty sure that IFS will work across workbooks only if both workbooks are open.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    03-31-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    632

    Re: IF/IFS across multiple workbooks for direct link to main workbook?

    It does seem like that may be the case, AliG. Thanks for responding.

    What I was hoping/thinking was that if WB2 wasn't open, the IF statement would proceed to WB2 and retrieve data from there...

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: IF/IFS across multiple workbooks for direct link to main workbook?

    Can't you use IF (rather than IFS) with AND ?

    Pete

  5. #5
    Forum Contributor
    Join Date
    03-31-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    632

    Re: IF/IFS across multiple workbooks for direct link to main workbook?

    Hi, Pete,

    Would you be so kind to give me a suggestion on how to do that?

    I did try a simple IF at first (had to translate it using a translator, so apologies if the syntax should be incorrect):

    Please Login or Register  to view this content.
    Thanks in advance.

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: IF/IFS across multiple workbooks for direct link to main workbook?

    I have an old version of Excel on this PC, but I'm in the process of upgrading to a new PC in another room, so I'll get back to you on that.

    It would help if you attached samples of your workbooks so I can click in the cells to get the structured references. Can you also tell me the full path(s) to your files.

    Pete

  7. #7
    Forum Contributor
    Join Date
    03-31-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    632

    Re: IF/IFS across multiple workbooks for direct link to main workbook?

    Hi, Pete,


    Thanks. And no rush!

    I realize attaching the workbooks would be the best, but I would have to take some time to anonymize them if so be and I'm not sure I can find time for that until tomorrow. If you want to or can spell out the pseudo-code/principle instead, I can try to finalize it on my own.

    If not, I should be able to do it some time tomorrow.

    Best regards,

    Elijah

  8. #8
    Forum Contributor
    Join Date
    03-31-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    632

    Re: IF/IFS across multiple workbooks for direct link to main workbook?

    Hi again,

    I created 3 sample workbooks: WB1, WB2 and WB3 and did some testing of my own.

    1) Open only WB1. You should get #REF on the linked column.

    2) Open WB3. Copy and paste the date values into the table in order to "update" the table and make it correct. Nothing happens.

    3) Open WB2. WB1 automatically updates with values from WB3. No changes are done in WB2.

    So, it seems like it's exactly how Ali said it to be: both workbooks needs to be open. I assume the IF loops through both workbooks and if WB2 isn't there it stops from completing.

    The simple solution is to simply have both workbooks open at once. It's no big deal. But if there's a way around it - I'd love to hear it.
    Attached Files Attached Files

  9. #9
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: IF/IFS across multiple workbooks for direct link to main workbook?

    Use normal reference instead of structured reference

    =IF([@Date]=[WB2.xlsx]Ark1!$D8,[WB2.xlsx]Ark1!$B8,IF([@Date]=[WB3.xlsx]Ark1!$D$8,[WB3.xlsx]Ark1!$B8,""))

  10. #10
    Forum Contributor
    Join Date
    03-31-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    632

    Re: IF/IFS across multiple workbooks for direct link to main workbook?

    Hey, Bo_Ry,

    Thank you!

    That did seem to work great. The only problem is that when I update my source table in WB1 (it copies data from an SQL DB) - I get #REF using this solution.

    So, I suppose I just have to settle on needing to have both workbooks open at once and using the original formula.

    Thanks.

    Elijah

+ 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] link data from another workbook to one main workbook
    By tata_ancona in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-09-2017, 10:20 AM
  2. [SOLVED] Update Main Workbook from 3 other workbooks
    By LewisJ in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-23-2017, 08:28 AM
  3. Creating a Macro that Imports data from multiple workbooks into one Main workbook
    By MacroHelp911 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-04-2013, 11:03 AM
  4. Generate separate workbooks from main Workbook
    By robbie58 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-15-2012, 05:08 PM
  5. Link multiple workbooks to master workbook (below each other)
    By monkeywrench55 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-05-2011, 04:08 AM
  6. Close all workbooks except for the main workbook
    By Khaos176 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-21-2009, 02:48 PM
  7. [SOLVED] Macro to link Sheets to main workbook
    By raven_guy in forum Excel General
    Replies: 0
    Last Post: 06-24-2005, 08:05 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