Obtain a Unique list based on the sum of another column

espinozr

New Member
Joined
Jun 4, 2019
Messages
18
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have a table with two columns and many rows, where the first column has some repeated items and the second columns have numbers. Let's say:

ColumnAColumnB
D3
A1
B2
C0
A4
B5
C0

I need to obtain a unique list (top10 only) from column A where the sum of column B is above 0. I managed to extract the full list, but I'm having issues to filter the "0". I'm using the following:

=LET(y,ColumnA,x,UNIQUE( y),SORTBY(x,SUMIF(y,x,ColumnB),-1))

Two problems:
  1. If the ColumnA has less than 10 unique items, the formula returns the list of items, and then a row with a "0".
  2. I only need the top10 items where the sum is above 0. I tried to filter this out by using "INDEX(UNIQUE(same formulas as above),SEQUENCE(10))", which works for the top10, but I can't filter out the 0.
Any ideas?
 
Last edited:

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
How about
Excel Formula:
=LET(u,UNIQUE(FILTER(A2:A100,A2:A100<>"")),s,SORT(HSTACK(u,SUMIFS(B:B,A:A,u)),2,-1),TAKE(FILTER(s,INDEX(s,,2)>0),10,1))
 
Upvote 0
Solution
How about
Excel Formula:
=LET(u,UNIQUE(FILTER(A2:A100,A2:A100<>"")),s,SORT(HSTACK(u,SUMIFS(B:B,A:A,u)),2,-1),TAKE(FILTER(s,INDEX(s,,2)>0),10,1))
You are a genius! I have no idea of how works many of the functions in this formula, but this 100% works.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,616
Latest member
intern444

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