How to get unique sorted indices of a list?

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,535
Office Version
  1. 365
Platform
  1. Windows
Is there a way to get a set of unique (integer) indices into a list of numbers with no duplicates?

In this minisheet, the Values row has the list of numbers. There are duplicates. There are 2 2's and 3 3's.

The Rank.Eq row has the sorted indices, but there are duplicates. The Rank.Avg has the sorted indices, but there are fractions and duplicates. The Solution row has the indices I would like to get, but I would also be happy with the alternate indces on the next row. Is there a way to get it?

Sorting.xlsx
BCDEFGHIJ
8Values36231283
9Rank.Eq32638613
10Rank.Avg426.5486.514
11Solution47251386
12/5/6/3/4/6/2/4/5
Sheet2
Cell Formulas
RangeFormula
C9:J9C9=RANK.EQ(Values,Values)
C10:J10C10=RANK.AVG(Values,Values)
Named Ranges
NameRefers ToCells
Values=Sheet2!$C$8:$J$8C9:J10


Thanks
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
What about
Excel Formula:
=SORTBY(SEQUENCE(,COUNT(Values)),Values)
Just like magic! 👍👏👍👏

Row 11, your solution, is identical to Row 9, the solution I wanted. I wasn't aware of SortBy. And I searched several times for ways to search. But what does your formula do that mine in Row 12 does not?

Sorting.xlsx
BCDEFGHIJ
7Index12345678
8Values36231283
9Solution wanted53614827
10Access via solution12233368
11PeterSS53614827
12Simpler?53614827
Sheet2
Cell Formulas
RangeFormula
C10:J10D10=INDEX(Values,1,D9)
C11:J11C11=SORTBY(SEQUENCE(,COUNT(Values)),Values)
C12:J12C12=SORTBY(Indices,Values,1)
Dynamic array formulas.
Named Ranges
NameRefers ToCells
Indices=Sheet2!$C$7:$J$7C12
Values=Sheet2!$C$8:$J$8D10:J10, C10:C12


Thank you
 
Upvote 0
But what does your formula do that mine in Row 12 does not?
It is more what your formula does that mine does not. Your formula uses a named range that was not given in post 10 (or post 5) and, as such, it also uses values that were described as ..
Row 7 is just for illustration.
.. and were not given in the original information. I took that to mean that they were not actually there in your real data and you put them in post 10 (&5) simply to help us understand what you wanted.
 
Upvote 0

Forum statistics

Threads
1,215,236
Messages
6,123,798
Members
449,127
Latest member
Cyko

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