I have fixed this problem now, but thought I would share it here in case someone else has the same error in their code and I save them from making my mistake.
I had some data with a column that used SUMIFS to calculate totals. When I sorted the data the results all went wrong, and it took me a while to find my error.
The data was on a sheet called Projects and the incorrect formula in cell G3 looked like this:
=SUMIFS(Expenditure!I:I,Expenditure!J:J,'Projects'!B3,Expenditure!A:A,Summary!$F$3)
When I sorted the data, the reference to 'Projects'!B3 remained unchanged, even though this was now on row 8 instead of row 3.
I corrected the formula to
=SUMIFS(Expenditure!I:I,Expenditure!J:J,B3,Expenditure!A:A,Summary!$F$3)
and everything now works correctly.
Cell references going wrong when I sort
-
- Administrator
- Posts: 12601
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Cell references going wrong when I sort
TX for the share Stuart.
If I remember correctly I can recall a similar error while processing a file for analysis. I cannot remember the actions I took that caused the error but I do recall it being due to the referencing of the current sheet name in the formula. It's almost like a sheet circular reference?!
If I remember correctly I can recall a similar error while processing a file for analysis. I cannot remember the actions I took that caused the error but I do recall it being due to the referencing of the current sheet name in the formula. It's almost like a sheet circular reference?!
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- 5StarLounger
- Posts: 817
- Joined: 24 Jan 2010, 15:56
Re: Cell references going wrong when I sort
Excel treats it like a reference to another sheet so it doesn't get treated as being relative to the formula cell when you sort.
Regards,
Rory
Rory
-
- Administrator
- Posts: 12601
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Cell references going wrong when I sort
I wish I'd known that earlier Rory.rory wrote:Excel treats it like a reference to another sheet so it doesn't get treated as being relative to the formula cell when you sort.
StuartR
-
- 5StarLounger
- Posts: 817
- Joined: 24 Jan 2010, 15:56
Re: Cell references going wrong when I sort
I always figure you're more likely to remember it when you learn it the hard way. ;)
Regards,
Rory
Rory
-
- Administrator
- Posts: 12601
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Cell references going wrong when I sort
You're not wrong there. I always explained to my kids that they could avoid all those stupid mistakes by paying attention to my wise advice. Might as well have saved my breath.rory wrote:I always figure you're more likely to remember it when you learn it the hard way. ;)
StuartR