+ Reply to Thread
Results 1 to 4 of 4

Access data refresh changes ranges in formulas

  1. #1
    Forum Contributor
    Join Date
    07-02-2012
    Location
    UK
    MS-Off Ver
    365/2008
    Posts
    152

    Access data refresh changes ranges in formulas

    I have a spreadsheet linked to an access database. On one worksheet I have some formulas that include ranges to calculate some of the data from the import.

    However, each time I refresh the data, the upper cell named in the range within the formula has increased. E.g. $A$2:$A$10000 could read $A$2:$A$10020 at next refresh.

    Is this typical of a link to access? I set all ranges from 2:10000 to take into account growth in the number of records in the database. Have I then, set my ranges up wrong? If so, how should I do it?

    Also, why do I keep getting errors if a record is deleted in the access database?

  2. #2
    Forum Contributor
    Join Date
    01-04-2013
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2013
    Posts
    142

    Re: Access data refresh changes ranges in formulas

    Perhaps try using named ranges in your formulas. Make the named ranges dynamic using the offset formula in the "Refers To" box. This automatically adjust the height of your range to equal the number of rows that have data. The basic offset formula for a dynamic named range is

    =Offset($A$1,0,0,CountA($A:$A),1)

    $A$1 refers to the starting cell of your data column. If your data has a header row and your actual data starts in row two use $A$2

    CountA($A:$A) sets the height of your range by counting the number of rows in Column A that contain data. Again, if your data has a header row, change the formula to CountA($A:$A)-1

    This formula only works properly is the column referenced in the CountA formula does not have any blanks.

    A search for Dynamic Named Ranged should give you plenty of more detailed walkthroughs.

  3. #3
    Forum Contributor
    Join Date
    07-02-2012
    Location
    UK
    MS-Off Ver
    365/2008
    Posts
    152

    Re: Access data refresh changes ranges in formulas

    Quote Originally Posted by mo4391 View Post
    ...

    This formula only works properly is the column referenced in the CountA formula does not have any blanks.

    ...
    Unfortunately, this is where using dynamic named range would fall flat because there will be blanks from the Access import

  4. #4
    Forum Contributor
    Join Date
    01-04-2013
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2013
    Posts
    142

    Re: Access data refresh changes ranges in formulas

    Will all columns have blanks? Your data in Access likely has at least one field that doesn't allow blanks, either a primary key, or at the very least, a record count field. Include that field in your export from Access. Then just use that column for the address in the CountA formula. The column used in the CountA formula doesn't have to be the same column of your named range.

+ 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] Allow refresh to users who are read only and don't have access to data connected material
    By cmorten82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-14-2016, 01:28 PM
  2. Insert sequence numbers & change on refresh - using access external data
    By LALTIZER in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-15-2015, 04:56 PM
  3. [SOLVED] Formulas not copying down upon data refresh
    By martinpgibson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-01-2014, 11:49 PM
  4. Replies: 5
    Last Post: 11-07-2013, 02:48 PM
  5. ACCESS: Using Excel formulas with ACCESS ranges
    By zazathedog in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-05-2013, 06:25 AM
  6. what solution to auto refresh for import data from access
    By okl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-05-2010, 06:46 AM
  7. [SOLVED] Ridirect & Refresh data from access database
    By widman in forum Excel General
    Replies: 2
    Last Post: 03-11-2006, 02:35 PM

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