+ Reply to Thread
Results 1 to 8 of 8

#REF Error When Copying A Sheet In A Sum Range

Hybrid View

  1. #1
    Registered User
    Join Date
    07-05-2005
    Posts
    11

    Question #REF Error When Copying A Sheet In A Sum Range

    Here's my issue, the basic version. Let's say I have a new blank workbook with the standard three base sheets; Sheet1, Sheet2, Sheet3. In cell A1 of each worksheet I'll input a number; for the purposes of ease I'll just input "1". In cell A2 of each worksheet I'll input the following formula: =SUM(Sheet1:Sheet3!A1), so cell A2 of all the worksheets displays "3". Now, if I copy Sheet1 (to any position), the formula in the newly copied sheet ('Sheet1 (2)') breaks and generates a #REF error ('=SUM(#REF!A1)'). However, if I copy either Sheet2 or Sheet3, no error is encountered in the copied sheets. I'd be grateful for any explanation of this behaviour and a method for dealing with it. As usual, I'd like to avoid any VBA solutions for the time being and hope for a workaround using base Excel formulas. I'd also like to not have to create a hidden sheet that acts as the first sheet in the range as a workaround. Thanks for reading!

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: #REF Error When Copying A Sheet In A Sum Range

    A great way to sum across all sheets is too create two sheets, one called first and one called Last.

    Now put everything in-between those two sheets and use...

    =SUM(First:Last!A1)
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    07-05-2005
    Posts
    11

    Re: #REF Error When Copying A Sheet In A Sum Range

    Quote Originally Posted by jeffreybrown View Post
    A great way to sum across all sheets is too create two sheets, one called first and one called Last.

    Now put everything in-between those two sheets and use...

    =SUM(First:Last!A1)
    @jeffreybrown

    That was the exact thing I was hoping to avoid. For the sake of tidiness, I don't want to create superfluous sheets like this, even if they can be hidden and kept out of the way, because my formulas rely on strict, self-explanatory naming conventions in order to be user-friendly for both Excel novices and experts. I'm almost more interested in why this behaviour occurs in the first place as there are many obvious workarounds but I'd like to keep the solution direct.

    @popipipo

    As for the single quotes, Excel is accounting for those automatically with copied sheets without me manually adjusting the formulas. If Sheet2 and Sheet3 are copied, the A2 cell will then reflect "5" for totaling the five worksheets. The issue is simply when Sheet1 is copied the sum formula worksheet references are completely destroyed for reasons I don't understand.

    Thanks for your responses.

  4. #4
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,647

    Re: #REF Error When Copying A Sheet In A Sum Range

    Your missing the qoutes

    =SUM('Sheet1:Sheet3 (2)'!A1)

    You needs those if there are spaces in the sheetnames.
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: #REF Error When Copying A Sheet In A Sum Range

    @ popipipo...you only really need the ' if there is a space in the sheet name - although it does no harm to include them like that

    Edit: It was brought to my attention that the sum() you used does in fact have spaces...
    =SUM('Sheet1:Sheet3 (2)'!A1)
    so you were correct to use ' aplogies
    Last edited by FDibbins; 09-02-2013 at 05:26 PM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: #REF Error When Copying A Sheet In A Sum Range

    Quote Originally Posted by centerNegative View Post
    I'd be grateful for any explanation of this behaviour and a method for dealing with it.
    Seems I gave you a method to deal with it in =SUM(First:Last!A1)

    It seems the reason you get the =SUM(#REF!A1) is because when you copied Sheet1 and created Sheet1 (2) it is not part of the original =SUM(Sheet1:Sheet3!A1) so it seems Excel can't deal with it...

    By creating the First sheet and the Last sheet and placing everything in-between, Excel seems to always know where to start, where to end, and what's in-between.

    If this does not help then maybe popipipo or FDibbins has an alternate solution or explanation...

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: #REF Error When Copying A Sheet In A Sum Range

    my formulas rely on strict, self-explanatory naming conventions in order to be user-friendly for both Excel novices and experts
    I dont see how this will impact on having start - and end - (blank) helper sheets. They do not need to have data on them, and you could even give them a background that says "Not for Use" or something.

    Using this method is almost SOP for both more experienced and novice excel users alike, and keeps things simple and clean.

    I guess what I'm saying is - I dont have anything more to add than Jeff already has, sorry

  8. #8
    Registered User
    Join Date
    07-05-2005
    Posts
    11

    Wink Re: #REF Error When Copying A Sheet In A Sum Range

    Appreciate all the feedback!

+ 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. Copying Data error from master sheet based on Range criteria
    By naga in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2013, 02:11 AM
  2. [SOLVED] Copying one sheet to another Error
    By johnph in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-03-2012, 08:59 AM
  3. When copying sheet I get this error
    By JK1234 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-06-2009, 10:10 AM
  4. [SOLVED] Copying Sheet - subscript out of range error
    By GSP@DCS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-01-2006, 09:00 PM
  5. Replies: 3
    Last Post: 07-24-2006, 08:20 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