+ Reply to Thread
Results 1 to 17 of 17

Error on formula after deleting a line on related sheet

  1. #1
    Registered User
    Join Date
    10-16-2009
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003
    Posts
    17

    Error on formula after deleting a line on related sheet

    Dear Friends,

    I have a problem that I can't fix.

    I'm using two sheets, on sheet2 I have formulas related with sheet1.
    When I delete a row on sheet1, I loose the formula of the cooresponding row on sheet2...

    Here you have an example of the formula of first content row of sheet2.

    {=IF(ISERR(INDEX(sheet1!A$2:O$1008,SMALL(IF($E$1=sheet1!A$2:A$1008,ROW(sheet1!A$2:A$1008)-MIN(ROW(sheet1!A$2:A$1008))+1,""),ROW(sheet1!E1)),COLUMN(sheet1!E1))),"",IF(INDEX(sheet1!A$2:O$1008,SMALL(IF($E$1=sheet1!A$2:A$1008,ROW(sheet1!A$2:A$1008)-MIN(ROW(sheet1!A$2:A$1008))+1,""),ROW(sheet1!E1)),COLUMN(sheet1!E1))="","",INDEX(sheet1!A$2:O$1008,SMALL(IF($E$1=sheet1!A$2:A$1008,ROW(sheet1!A$2:A$1008)-MIN(ROW(sheet1!A$2:A$1008))+1,""),ROW(sheet1!E1)),COLUMN(sheet1!E1))))}

    If I delete first content row on sheet1, I get the following error formula on second content row of sheet2

    {=IF(ISERR(INDEX(sheet1!A$2:O$1006,SMALL(IF($E$1=sheet1!A$2:A$1006,ROW(sheet1!A$2:A$1006)-MIN(ROW(sheet1!A$2:A$1006))+1,""),ROW(sheet1!#REF!)),COLUMN(sheet1!#REF!))),"",IF(INDEX(sheet1!A$2:O$1006,SMALL(IF($E$1=sheet1!A$2:A$1006,ROW(sheet1!A$2:A$1006)-MIN(ROW(sheet1!A$2:A$1006))+1,""),ROW(sheet1!#REF!)),COLUMN(sheet1!#REF!))="","",INDEX(sheet1!A$2:O$1006,SMALL(IF($E$1=sheet1!A$2:A$1006,ROW(sheet1!A$2:A$1006)-MIN(ROW(sheet1!A$2:A$1006))+1,""),ROW(sheet1!#REF!)),COLUMN(sheet1!#REF!))))}

    Instead of #REF! I should have E2...

    Can someone help me?

    Thanks in advance.

    Files attached.

    Regards,
    D. Duarte
    Attached Files Attached Files

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Error on formula after deleting a line on related sheet

    Hi,

    It's generally better practice to use a construction with ROWS(), rather than ROW(), in these cases, the principal reason being that it is not susceptible to row insertion/deletion, as in your example.

    In column B, try replacing all occurrences of ROW(Sintra!G1) with ROWS(Sintra!G$1:G1) and all occurrences of COLUMN(Sintra!G1) with COLUMNS(Sintra!A$1:G1).

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    10-16-2009
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Error on formula after deleting a line on related sheet

    Hi there,

    Thanks for helping.

    With your suggestion I get the results from column A, not column G.

    What need to be changed?

    Thanks,
    D. Duarte

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Error on formula after deleting a line on related sheet

    That's not possible if you did as I suggested. Can you double-check you typed/copied COLUMNS(Sintra!A$1:G1) and not, for example, COLUMNS(Sintra!A$1:A1)?

    If you still can't get it to work, re-post your attachment with your attempt in and I'll take a look.

    Regards

  5. #5
    Registered User
    Join Date
    10-16-2009
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Error on formula after deleting a line on related sheet

    Ok, I got it...

    I'm using:

    ROWS(Sintra!G$1:G1) COLUMNS(Sintra!A$1:G1)

    ROWS(Sintra!G$1:G2) COLUMNS(Sintra!A$1:G2)

    ROWS(Sintra!G$1:G3) COLUMNS(Sintra!A$1:G3)

    Now if I delete the first content row of sheet1, on the second content row of sheet2 I get the same content of first content row of sheet2...

    Maybe I'm still doing something wrong with your suggestion...

    Can you check the attached files and modify them with your suggestion?

    Sorry

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Error on formula after deleting a line on related sheet

    Apologies. I had the dollar sign in the wrong place for the COLUMNS part.

    In any case, since we don't need to reference the Sintra tab for these constructions, we can simplify slightly to (for the formula in B4):

    ROWS($1:1) and COLUMNS($A:G)

    in place of the previous suggestions.

    Regards

  7. #7
    Registered User
    Join Date
    10-16-2009
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Error on formula after deleting a line on related sheet

    Hi,

    Thanks again.

    Your last suggestion returns an empty result, even before deleting any row on sheet1 (Sintra).

    Regards,
    D. Duarte

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Error on formula after deleting a line on related sheet

    Hi,

    Could you re-attach your workbook with your formula adaptations and these empty results?

    Regards

  9. #9
    Registered User
    Join Date
    10-16-2009
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Error on formula after deleting a line on related sheet

    Here you have.

    I noticed that after ENTER, I get the following:

    ROWS(#ref!#REF!$1:1));COLUMNS($A:G)
    Attached Files Attached Files

  10. #10
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Error on formula after deleting a line on related sheet

    What on earth have you done in here?? Where do all these "#ref" #REF!:1 and "$a":"g" entries come from?

    Regards

  11. #11
    Registered User
    Join Date
    10-16-2009
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Error on formula after deleting a line on related sheet

    Hello XOR LX,

    A very busy week...

    Well that's what happens after modifying the formula with ROWS($1:1) and COLUMNS($A:G) and hit the enter key...

    Thanks,
    D. Duarte

  12. #12
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Error on formula after deleting a line on related sheet

    Not at all. You must have done something very strange...

    See attached.

    Regards
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    10-16-2009
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Error on formula after deleting a line on related sheet

    Hello there,

    Sorry for the long delay, I've been extremely busy

    I tested your sheet, it seems to be better than mine, but something is not working ok.

    On Cartão Sintra sheet if you change E1 from LS-02 to LS-04, you will get B4 empty, why is that?

    Sorry to disturb you with this...

    D. Duarte

  14. #14
    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: Error on formula after deleting a line on related sheet

    I just tested the file and used LS-04, seems to work fine?
    A
    B
    C
    D
    E
    F
    1
    Ref
    LS-04
    2
    3
    City
    Street
    4
    Penedo
    Casa Fim
    5
    Banzão
    Atlântico, (Av)
    6
    Nora
    Alfredo Dias, (Rua)
    7
    Pinhal da Nazaré
    Roma, Av
    ...
    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

  15. #15
    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: Error on formula after deleting a line on related sheet

    here is another option, using a helper column and a far simpler formula
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    10-16-2009
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Error on formula after deleting a line on related sheet

    Maybe that's cause I'm using open office...

    Your second option works ok
    I will have to test it with diferent scenarios, but I guess it's the right option.

    Thanks a lot, I will confirm if it works as I need.

    D. Duarte

  17. #17
    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: Error on formula after deleting a line on related sheet

    Keep me posted

+ 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 calculate a formula when an error occurs within the related cells
    By cassyleighnz in forum Excel General
    Replies: 5
    Last Post: 12-11-2012, 05:00 AM
  2. [SOLVED] Related question to this previous post: Deleting all but a few columns
    By iekika13 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-17-2012, 12:13 PM
  3. Replies: 3
    Last Post: 02-17-2011, 06:38 AM
  4. Deleting a sheet error window
    By Ricardo9211 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2009, 11:02 PM
  5. [SOLVED] deleting line item in import function causes REF# error
    By Jen in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-12-2006, 09:24 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