Trouble Sorting Formulas

elotromateo

New Member
Joined
May 19, 2010
Messages
42
I am having trouble sorting formulas that are referencing another part of the range that is being filtered. Currently, there are names in ColA, and values that are calculated based on ColA in ColC. So if Smith is in Row2, there is a number corresponding to that name in ColC, Row2. However, if I try and sort ColC from smallest to largest, it moves the cells around based on their current value, but no longer follows the correct name. So if Smith now resides in Row10, the cell that used to be in ColC, Row2 has also moved to Row10, but still references ColA, Row2, giving the incorrect value for Smith.

Is there any way to avoid this?
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Sorry, I should have given more information. Here is the formula:

Code:
=SUMIFS(Meter_Arr,Name_Arr,'Total Data'!$A3,Year_Arr,'Total Data'!C$1)

Meter_Arr is Column C, Bldg_Arr is Column A, and Name_Arr is Column F. All are references to a different sheet.
 
Upvote 0
There might be a more elegant way to do this...but this seems to work:

In Cell C2 and copy down
=SUMIFS(Meter_Arr,Name_Arr,OFFSET('Total Data'!C2,0,-2),Year_Arr,'Total Data'!C$1)

The Offset function keeps the formula from tracking the original values
in Column A and instead just references Column A on the same row.
 
Upvote 0
Thanks, that's not what I ended up doing, though it looks like it would work.

It turns out that having the sheet name in front of the cell reference sort of locked it onto that cell. I ended up making an if statement that allowed me to get rid of the sheet name since I no longer referenced another sheet first and now it works quite well.
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,849
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top