Bug 79475

Summary: Other: Formula error when copying and pasting a SUBTOTAL formula
Product: LibreOffice Reporter: Grant Botes <botes.grant>
Component: CalcAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED NOTABUG    
Severity: normal CC: miguelangelrv
Priority: medium    
Version: 4.2.4.2 release   
Hardware: Other   
OS: Linux (All)   
Whiteboard: BSA
Crash report or crash signature: Regression By:
Attachments: Source File
Destiny File

Description Grant Botes 2014-05-31 08:28:48 UTC
I am analysing sick leave usage, using a SAP sick leave extract, LibreOffice Calc 4.2.4 on Ubuntu 14.04. I have extracted the relevant elements I need to analyse using a Pivot Table and pasted them into a new worksheet, so I have a simple table without formulas. I add a row at the bottom, and use SUBTOTAL to sum the columns. Now, I apply a Standard Filter to the table, to display sick leave usage of between 30 and 60 days. I unhide just the row containing the SUBTOTAL summed values. So far, so good - the values calculate correctly.

Now the problem - I copy the filtered list and use PASTE SPECIAL to paste the values into a new worksheet. All the SUBTOTAL formulas display #REF, and the pasted values look like this: =SUBTOTAL(9,E#REF!:E59)
Operating System: Ubuntu
Version: 4.2.4.2 release
Comment 1 Grant Botes 2014-05-31 10:13:01 UTC
Hmm, not so sure about this now - this bug appeared for me three times, but suddenly I am unable to duplicate it.
Comment 2 Grant Botes 2014-05-31 10:18:37 UTC
Ok, the bug appears again when using Paste, not Paste Special. Subtotal formula doesn't paste over into a new sheet; the formula becomes: =SUBTOTAL(9,E#REF!:E59)
Comment 3 m_a_riosv 2014-06-02 20:47:51 UTC
Hi Grant, thanks for reporting.

I think the problem is, if you have in:

E60: SUBTOTAL(9:E1:E59)

copying to a row above the 60 you get the error in the reference, because E1 is a relative reference and can't be adapted to a row less than 1.

make absolute the initial row in the formula:

E60:  SUBTOTAL(9:E$1:E59)

and try to copy.

Please lets us know if this solves your issue.

If not, can you attach a sample file and detail copy steps?
Comment 4 Grant Botes 2014-06-03 18:16:12 UTC
Thank you - you have explained it. I was puzzled by the intermittent nature of the problem. Now that you have pointed it out, I realise that is exactly what I was doing - I was pasting data over two rows higher than I was copying it from. Now I just feel embarassed at making such a silly mistake.
Comment 5 m_a_riosv 2014-06-03 20:21:13 UTC
Don't worry Grant, sometimes we have the issue in front us without see it, and we need someone else open our eyes. Typical writing a letter. :)
Comment 6 Emersson Augusto Suarez Ortiz 2015-08-24 17:43:46 UTC
Hello to All.
thanks for the firs time explanation, but I disagree, cause when you copy and paste in a new file the error appears again, and I'm sure the row are the same. In my case, I have a file wiht many providers of elements, I filter each one and then copy and paste in a new file and get the error whit subtotals. In LibreOffice 5 Win 8.1 and Ubuntu 14.04

After read this explanation, I put the reference as fixed whit "$", but the error still exist.
Comment 7 m_a_riosv 2015-08-24 20:25:25 UTC
Please @Emerson, can you attach a couple of sample files, and describes what you copy and where.
Remember to delete any private/confidential information, this a public site.
Comment 8 Emersson Augusto Suarez Ortiz 2015-08-24 20:53:11 UTC
Created attachment 118132 [details]
Source File

This file is the source one, ther first sheet is the original data set, the second is the copy result. No error
Comment 9 Emersson Augusto Suarez Ortiz 2015-08-24 20:54:29 UTC
Created attachment 118133 [details]
Destiny File

This is the destiny file, when you copy the row, subtotal has an error, reference error, and does not matter if is in the same range.
Comment 10 Emersson Augusto Suarez Ortiz 2015-08-24 20:56:53 UTC
Well, good afternoon to all. The files are: Source: is the original file, it has 2 sheets, the first one is the very source of data, and the second one is the one who has the copied files. No error in ther.

The second file is Destiny, is when you copy the same information in other file in the same range or in diferent range. There is the error with subtotals.
Comment 11 m_a_riosv 2015-08-24 21:12:02 UTC
The issue is reproducible only copying including column titles, if the copy is from A9:N272, no issue.

Please @Emerson, could you open a new bug, because it's a different issue than the original reported here.