Sorting on one sheet messes up my formula from a different sheet

dmoore702

New Member
Joined
Jun 21, 2015
Messages
18
I have two sheets for a fantasy golf contest, a money sheet and a scoring sheet. One column from the money sheet references a cell from the scoring sheet, (='Score Sheet'!G3).
When I run a macro to sort the scoring sheet, I want the column from the money sheet to follow the sort. The cell remains (='Score Sheet'!G3) after the sort when I'd like it to be K3 or wherever the sort takes it.
Attached is my scoring sheet. If I sort by session 2 row (largest to smallest) then McBoing would be first, RatFarts second etc, but the formula from the other page does not follow the sort
Any ideas?? Thanks in advance
1 g1.png

1 g2.png
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi dmoore702,

To make the reference in the money sheet column update after the sort, you can use the OFFSET function in the cell formula to dynamically reference the correct cell based on the new position after the sort.

Assuming the column with the reference formula is column G in the money sheet and you want to reference column K in the same row after sorting, you can modify the existing formula to:

VBA Code:
=OFFSET('Score Sheet'!$K$1, MATCH('Money Sheet'!A1,'Score Sheet'!$A:$A,0)-1, 0)

Here, the OFFSET function starts at cell K1 on the Score Sheet, and then uses the MATCH function to find the row in column A of the Score Sheet that matches the value in cell A1 of the Money Sheet. The MATCH function returns the relative position of the row in the range, so we subtract 1 to get the correct row index for the OFFSET function. The 0 in the final argument of the OFFSET function indicates that we want to reference the same column (i.e., zero columns over from K).

After you run the sort macro, the formula in the money sheet column will update to reflect the new position of the referenced cell on the Score Sheet.

I hope this helps you. Let me know.
 
Upvote 0

Forum statistics

Threads
1,214,375
Messages
6,119,167
Members
448,870
Latest member
max_pedreira

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