 # How to Move a row to the bottom of "Unique" function automatically

Occasional Visitor

# How to Move a row to the bottom of "Unique" function automatically

Hi guys,

I have a table that can change,

Adding to the table will effect a unique function on another sheet,

I want to always show the Total at the bottom of the Unique function, however, if items get in the way of the unique (by adding items to the table) I will get a spill error

Is there a way to keep the Total at the bottom of the unique function regardless of its length?

Thanks for the help.

2 Replies

# Betreff: How to Move a row to the bottom of "Unique" function automatically

With your permission, if I can recommend. It can help us all if you upload an Excel file (without sensitive data), no picture. Even if it is said that a picture can say a thousand words, it is certainly not in the case of Excel, on the contrary in some cases. You could get a precise solution much faster with a file (w/out sensitive data). This would also be a blessing for all of us, as we can understand the problem much better, a win-win situation for everyone.

* Knowing the Excel version and operating system would also be an advantage.

Thank you for your understanding and patience

Nikolino

I know I don't know anything (Socrates)

# Re: How to Move a row to the bottom of "Unique" function automatically

@CodyBarber If I understand correctly you have a column where at the top you use the UNIQUE() function on a different column of numbers.  at the bottom of the resulting list you want a SUM().  The problem is if there are 3 unique values that SUM/Total would be in the 4th row but then if you add another unique value to the original list you SUM equation in the 4th row would now interfere with the UNIQUE() function spill.

So the easiest solution is to just flip it over and make row 1 your Total and then the UNIQUE() function would be in row 2 and spill down.

If you insist on doing it the other way it can be done but each option I see is 'not pretty'.  My first 'solution' was to use a helper column with the UNIQUE() function (which could be hidden) and then in the next column use a formula that basically looks at the other column and if there is a value then use it else if the previous row had a value than use SUM() of previous column else "".  Something like this (with the hidden UNIQUE() function in col C):

``=IFS(ROW(C:C)<=COUNT(C1#),C1#,ROW(C:C)-1=COUNT(C1#),SUM(C:C),1=1,"")``

but then I got creative and came up with a single formula solution:

``=CHOOSE(FLOOR.MATH(SEQUENCE(COUNTA(UNIQUE(A:A))+1,1,1,1/COUNTA(UNIQUE(A:A)))),UNIQUE(\$A:\$A),SUM(UNIQUE(A:A)))``

like I said 'not pretty' and just putting the sum in Row 1 would be easier.