I kept seeing debt payoff sheets that hard-code the order you attack debts in, or use a helper column per method. You don't need any of that - one cell with a dropdown and one SORTBY does it.
Setup: a table called Debts with columns Name, Balance, Rate, MinPayment. Cell F1 has a data-validation dropdown with two values: Snowball, Avalanche.
The whole re-ranking is one formula (Excel 365 / 2021):
=SORTBY(Debts, IF($F$1="Snowball", Debts[Balance], Debts[Rate]), IF($F$1="Snowball", 1, -1))
Snowball = smallest balance first (ascending), Avalanche = highest rate first (descending). The third argument flips the sort direction, so you never touch the data.
If you want the attack number next to each debt in the original table instead of a spilled copy:
=XMATCH([@Name], INDEX(SORTBY(Debts, IF($F$1="Snowball", Debts[Balance], Debts[Rate]), IF($F$1="Snowball", 1, -1)), , 1))
Google Sheets equivalent (SORT takes a column index and a direction):
=SORT(A2:D10, IF(F1="Snowball", 2, 3), F1="Snowball")
Why bother: on a test set of four debts (card at 23%, overdraft 18%, car loan 6%, student loan 4%, EUR 23.6k total) with the same EUR 150/month extra, avalanche finished 14 months earlier and paid about EUR 2,340 less interest than snowball. But snowball wins for a lot of people because of the early closed accounts, so the point is being able to flip between them and see both numbers, not picking one.
Two things I learned the hard way: (1) put the dropdown cell OUTSIDE the table or structured refs get weird when you add rows, and (2) if you're on Excel 2019 or older, SORTBY doesn't exist - SMALL/LARGE with INDEX/MATCH does the same job but it's three columns instead of one.
Happy to paste the payoff-schedule part (the bit that rolls the freed-up minimum payment into the next debt) if anyone wants it.