+ Reply to Thread
Results 1 to 9 of 9

Reference Cell Deleted - Avoiding #REF!

  1. #1
    Registered User
    Join Date
    01-13-2015
    Location
    OHIO
    MS-Off Ver
    2013 AND 2010
    Posts
    5

    Reference Cell Deleted - Avoiding #REF!

    Hello,

    I have an Excel sheet (SheetA) that refers to another to collect data (SheetB). SheetB is used for presenting the initial data, and SheetA is hidden and used solely as a bridge for charts on other sheets. Because SheetB is used in presentations, it must be kept neat, and any cells not in use must be deleted.

    Long story short, is there any formula that allows the cells on SheetA to return a value equal to 0 if one or all of the reference cells are deleted from SheetB?

    I am just looking for a general formula that I can add to my existing.

    Example:

    'SheetB'!A1=P
    'SheetB'!B1=E

    'SheetA'!A1=COUNTIFS('SheetB'!$A1:$A4,"P",'SheetB'!$B1:$B4,"E")

    The resulting count would be 1

    If I were to delete rows 1-4 from SheetB, I need the count to equal 0, not #REF!

    Thank you in advance

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

    Re: Reference Cell Deleted - Avoiding #REF!

    Use 'iferror'
    =iferror(COUNTIFS('SheetB'!$A1:$A4,"P",'SheetB'!$B1:$B4,"E"),"")
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  3. #3
    Registered User
    Join Date
    03-22-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Reference Cell Deleted - Avoiding #REF!

    I agree. But if you want a result of 0 instead of a blank cell:

    =IFERROR(SheetA!A1=COUNTIFS(SheetB!$A1:$A4,"P",SheetB!$B1:$B4,"E"),0)

  4. #4
    Registered User
    Join Date
    01-13-2015
    Location
    OHIO
    MS-Off Ver
    2013 AND 2010
    Posts
    5

    Re: Reference Cell Deleted - Avoiding #REF!

    This works perfect, Thank you!!

  5. #5
    Registered User
    Join Date
    03-22-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Reference Cell Deleted - Avoiding #REF!

    Yay! Glad to help.

  6. #6
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Reference Cell Deleted - Avoiding #REF!

    Oddly enough, when I copied and pasted the formula =COUNTIFS('SheetB'!$A1:$A4,"P",'SheetB'!$B1:$B4,"E") and deleted all of the "P"'s or "E"'s, it returned a value of 0 in the cell SheetA A:1. Does the cell in your worksheet have some sort of formatting applied to it?

    Never mind, already resolved
    Last edited by gmr4evr1; 02-02-2015 at 04:28 PM.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  7. #7
    Registered User
    Join Date
    03-22-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Reference Cell Deleted - Avoiding #REF!

    IFERROR only takes effect if there is an error message like #N/A.

    If I am understanding the above post, you asked the formula in Sheet B to count occurrences, then deleted all the occurrences. So COUNTIFS returned a count of 0.

  8. #8
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Reference Cell Deleted - Avoiding #REF!

    Not all occurrences, either all the "P"'s or all the "E"'s. I didn't try deleting all of both. But yes, it did return a count of 0. There is a good chance I did something wrong and still achieved the result he wanted lol

  9. #9
    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
    52,946

    Re: Reference Cell Deleted - Avoiding #REF!

    Because SheetB is used in presentations, it must be kept neat, and any cells not in use must be deleted.
    I get that, but have you considered hiding those rows, instead of deleting them? As you have discovered, deleting cells (I assume you mean really deleting the cell/row, as opposed to deleting the contents?), causes all sorts of havoc with formulas
    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

+ 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. Keep reference to a cell when column is deleted
    By maido_11 in forum Excel General
    Replies: 10
    Last Post: 10-20-2020, 08:36 PM
  2. Adjacent cell reference - avoiding duplicates
    By ricdik in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-25-2013, 06:45 PM
  3. How do you reference cell value which will be deleted?
    By Lift Off in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-10-2010, 04:24 PM
  4. Keep Reference to a cell after Row or Column is inserted/deleted
    By BlueGunner in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-30-2010, 11:00 PM
  5. Deleted Reference Cell
    By rbmcclen in forum Excel General
    Replies: 1
    Last Post: 07-20-2006, 09:30 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