+ Reply to Thread
Results 1 to 8 of 8

Formula Referencing Cells that are Refreshed by Data Query

  1. #1
    Registered User
    Join Date
    04-10-2021
    Location
    Australia
    MS-Off Ver
    Full Desktop Apps (Office 365)
    Posts
    5

    Formula Referencing Cells that are Refreshed by Data Query

    Whenever the source of a data query (in this case pulling data from an API query) is temporarily broken (might happen once every day or once a week) the table that it brings into the sheet reduces from the usual several columns and rows to just 2 cells (the heading of the query and then just a 0 value as I've made it return that upon error).

    Looking for ideas and methods on either:

    1. upon data query error to create a table the same as what would be expected (rows and columns) should the query be successful and fill it with either last known values or 0s
    2. in excel formula somehow don't lose the cell reference when the data query fails and reduces to the 2 cell table (the formula ends up with #ref at the moment when the data query fails as the table loses most of its columns and rows)

    Thanks,
    Stuart.

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

    Re: Formula Referencing Cells that are Refreshed by Data Query

    Welcome to the forum.

    Do you have 2019 or 365? Please. Update your profile to be specific. Thanks.

    Is this PowerQuery that you are using? Why do you get the fail? That’s what I’d be addressing first. What you are asking for will require VBA at the least.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    04-10-2021
    Location
    Australia
    MS-Off Ver
    Full Desktop Apps (Office 365)
    Posts
    5

    Re: Formula Referencing Cells that are Refreshed by Data Query

    Desktop apps for Office 365 - (full excel application on Windows 10 although when you click about it says 365).

    It fails because the website in question may either be under maintenance or something happens where the query (runs every 15 seconds or every minute depending on which query) returns null but the next one might work.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,917

    Re: Formula Referencing Cells that are Refreshed by Data Query

    In my experience of PowerQuery, if a reference fails in the query, it doesn’t leave the results table empty, just not updated.

    How exactly is this set up? What sort of query is it?

  5. #5
    Registered User
    Join Date
    04-10-2021
    Location
    Australia
    MS-Off Ver
    Full Desktop Apps (Office 365)
    Posts
    5

    Re: Formula Referencing Cells that are Refreshed by Data Query

    The query is like this:

    = try Json.Document(Web.Contents("http......")) otherwise 0

    because if I don't put otherwise 0 then when it fails it displays a message box by default saying there was an issue or something and then it stops macros running in the background and everything stops. So I made it try it first then put 0 in if it failed which stopped the spreadsheet stopping but means that the table reduces to just a 0 and all my formulas based on it will then lose reference.

    Thanks for your response.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,917

    Re: Formula Referencing Cells that are Refreshed by Data Query

    There are instructions at the top of the page explaining how to attach your sample workbook.

  7. #7
    Registered User
    Join Date
    04-10-2021
    Location
    Australia
    MS-Off Ver
    Full Desktop Apps (Office 365)
    Posts
    5

    Re: Formula Referencing Cells that are Refreshed by Data Query

    See attached workbook - powerqueries inside.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    04-10-2021
    Location
    Australia
    MS-Off Ver
    Full Desktop Apps (Office 365)
    Posts
    5

    Re: Formula Referencing Cells that are Refreshed by Data Query

    Is it possible to do a try function but if it fails it does nothing and just leaves previous values or doesn't post anything at all??

+ 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] How to check if one query from Power Query was refreshed
    By jaryszek in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-10-2019, 11:10 AM
  2. Replies: 5
    Last Post: 10-03-2019, 07:23 PM
  3. Replies: 1
    Last Post: 01-05-2015, 05:39 PM
  4. Web query refreshed data should get saved
    By purusharth in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-15-2013, 01:44 AM
  5. Replies: 0
    Last Post: 08-03-2011, 08:40 AM
  6. Not all external data in cells being refreshed
    By errorfree in forum Excel General
    Replies: 1
    Last Post: 05-18-2011, 07:33 AM
  7. Downloading Refreshed Web Query Data into Adjacent Column
    By SteveC in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-07-2006, 12:35 PM

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