bit confusing.. so if I understand correctly, let's say you have a table from row 1 through 10, then the total in 11. Then, let's say in row 12 you want to compare the entry in row 10 to row 11... I'm guessing the problem is that if you sort, the last row may move and the formula refers to some other row than 10..
I assume to total row, row 11 is stable.. so you work off that
=INDIRECT(ADDRESS(11,2,4,,)) --this would give you the value in row 11, column B..
=INDIRECT(ADDRESS(10,2,4,,)) --this would be row 10
you can also build in formulas.. for example, instead of 11, you can put ROW(B11) which returns 11.. this is helpful if you copy the formula because it updates..
consequently, you can use ROW(B10) or ROW(B11)-1